From a2dda0c2bb88c1f009f7a10e0e344c4a301ff3b9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 17 Dec 2010 19:14:35 -0500 Subject: [PATCH] Trivial changes Whitespace fixes, comment formatting, etc --- gtk/gtkcellarea.c | 1650 ++++++++++++++++++----------------- gtk/gtkcellarea.h | 474 +++++----- gtk/gtkcellareabox.c | 1302 +++++++++++++-------------- gtk/gtkcellareabox.h | 34 +- gtk/gtkcellareaboxcontext.c | 320 +++---- gtk/gtkcellareaboxcontext.h | 76 +- gtk/gtkcellareacontext.c | 290 +++--- gtk/gtkcellareacontext.h | 86 +- 8 files changed, 2159 insertions(+), 2073 deletions(-) diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c index 184ac50c36..40a5c9eaa3 100644 --- a/gtk/gtkcellarea.c +++ b/gtk/gtkcellarea.c @@ -26,22 +26,23 @@ * @Short_Description: An abstract class for laying out GtkCellRenderers * @Title: GtkCellArea * - * The #GtkCellArea is an abstract class for #GtkCellLayout widgets (also referred - * to as "layouting widgets") to interface with an arbitrary number of #GtkCellRenderers - * and interact with the user for a given #GtkTreeModel row. + * The #GtkCellArea is an abstract class for #GtkCellLayout widgets + * (also referred to as "layouting widgets") to interface with an + * arbitrary number of #GtkCellRenderers and interact with the user + * for a given #GtkTreeModel row. * - * The cell area handles events, focus navigation, drawing and wraps geometrical + * The cell area handles events, focus navigation, drawing and * size requests and allocations for a given row of data. * - * Usually users dont have to interact with the #GtkCellArea directly unless they - * are implementing a cell layouting widget themselves. + * Usually users dont have to interact with the #GtkCellArea directly + * unless they are implementing a cell layouting widget themselves. * * * Requesting area sizes * * As outlined in GtkWidget's * geometry management section, GTK+ uses a height-for-width - * geometry managemen system to compute the sizes of widgets and user + * geometry management system to compute the sizes of widgets and user * interfaces. #GtkCellArea uses the same semantics to calculate the * size of an area for an arbitrary number of #GtkTreeModel rows. * @@ -50,11 +51,11 @@ * different layouting widgets. For instance a #GtkTreeViewColumn * always lines up the areas from top to bottom while a #GtkIconView * on the other hand might enforce that all areas received the same - * width and wrap the areas around, requesting height for more cell + * width and wrap the areas around, requesting height for more cell * areas when allocated less width. * - * It's also important for areas to maintain some cell - * alignments with areas rendered for adjacent rows (cells can + * It's also important for areas to maintain some cell + * alignments with areas rendered for adjacent rows (cells can * appear "columnized" inside an area even when the size of * cells are different in each row). For this reason the #GtkCellArea * uses a #GtkCellAreaContext object to store the alignments @@ -66,7 +67,7 @@ * #GtkCellArea which created it (see gtk_cell_area_create_context()). * The owning cell layouting widget can create as many contexts as * it wishes to calculate sizes of rows which should receive the - * same size in at least one orientation (horizontally or vertically), + * same size in at least one orientation (horizontally or vertically), * however it's important that the same #GtkCellAreaContext which * was used to request the sizes for a given #GtkTreeModel row be * used when rendering or processing events for that row. @@ -74,7 +75,7 @@ * In order to request the width of all the rows at the root level * of a #GtkTreeModel one would do the following: * - * Requesting the width of a hand full of GtkTreeModel rows. + * Requesting the width of a handful of GtkTreeModel rows * * GtkTreeIter iter; * gint minimum_width; @@ -91,22 +92,26 @@ * gtk_cell_area_context_get_preferred_width (context, &minimum_width, &natural_width); * * - * Note that in this example it's not important to observe the returned minimum and - * natural width of the area for each row unless the cell layouting object is actually - * interested in the widths of individual rows. The overall width is however stored - * in the accompanying #GtkCellAreaContext object and can be consulted at any time. - * - * This can be useful since #GtkCellLayout widgets usually have to support requesting - * and rendering rows in treemodels with an exceedingly large amount of rows. The - * #GtkCellLayout widget in that case would calculate the required width of the rows - * in an idle or timeout source (see g_timeout_add()) and when the widget is requested - * its actual width in #GtkWidgetClass.get_preferred_width() it can simply consult the - * width accumulated so far in the #GtkCellAreaContext object. - * - * A simple example where rows are rendered from top to bottom and take up the full - * width of the layouting widget would look like: + * Note that in this example it's not important to observe the + * returned minimum and natural width of the area for each row + * unless the cell layouting object is actually interested in the + * widths of individual rows. The overall width is however stored + * in the accompanying #GtkCellAreaContext object and can be consulted + * at any time. + * + * This can be useful since #GtkCellLayout widgets usually have to + * support requesting and rendering rows in treemodels with an + * exceedingly large amount of rows. The #GtkCellLayout widget in + * that case would calculate the required width of the rows in an + * idle or timeout source (see g_timeout_add()) and when the widget + * is requested its actual width in #GtkWidgetClass.get_preferred_width() + * it can simply consult the width accumulated so far in the + * #GtkCellAreaContext object. + * + * A simple example where rows are rendered from top to bottom and + * take up the full width of the layouting widget would look like: * - * A typical #GtkWidgetClass.get_preferred_width() for a layouting widget. + * A typical get_preferred_width() implementation * * static void * foo_get_preferred_width (GtkWidget *widget, @@ -122,22 +127,23 @@ * } * * - * - * In the above example the Foo widget has to make sure that some row sizes have - * been calculated (the amount of rows that Foo judged was appropriate to request - * space for in a single timeout iteration) before simply returning the amount - * of space required by the area via the #GtkCellAreaContext. - * - * Requesting the height for width (or width for height) of an area is a similar - * task except in this case the #GtkCellAreaContext does not store the data (actually - * it does not know how much space the layouting widget plans to allocate it for - * every row, it's up to the layouting widget to render each row of data with - * the appropriate height and width which was requested by the #GtkCellArea). - * - * In order to request the height for width of all the rows at the root level - * of a #GtkTreeModel one would do the following: + * In the above example the Foo widget has to make sure that some + * row sizes have been calculated (the amount of rows that Foo judged + * was appropriate to request space for in a single timeout iteration) + * before simply returning the amount of space required by the area via + * the #GtkCellAreaContext. + * + * Requesting the height for width (or width for height) of an area is + * a similar task except in this case the #GtkCellAreaContext does not + * store the data (actually, it does not know how much space the layouting + * widget plans to allocate it for every row, it's up to the layouting + * widget to render each row of data with the appropriate height and + * width which was requested by the #GtkCellArea). + * + * In order to request the height for width of all the rows at the + * root level of a #GtkTreeModel one would do the following: * - * Requesting the height for width of a hand full of GtkTreeModel rows. + * Requesting the height for width of a handful of GtkTreeModel rows * * GtkTreeIter iter; * gint minimum_height; @@ -149,7 +155,7 @@ * while (valid) * { * gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE); - * gtk_cell_area_get_preferred_height_for_width (area, context, widget, + * gtk_cell_area_get_preferred_height_for_width (area, context, widget, * width, &minimum_height, &natural_height); * * if (width_is_for_allocation) @@ -162,34 +168,39 @@ * } * * - * - * Note that in the above example we would need to cache the heights returned for each - * treemodel row so that we would know what sizes to render the areas for each row. However - * we would only want to really cache the heights if the request is intended for the - * layouting widgets real allocation. - * - * In some cases the layouting widget is requested the height for an arbitrary for_width, - * this is a special case for layouting widgets who need to request size for tens of thousands - * of treemodel rows. For this case it's only important that the layouting widget calculate - * one reasonably sized chunk of rows and return that height synchronously. The reasoning here - * is that any layouting widget is at least capable of synchronously calculating enough - * height to fill the screen height (or scrolled window height) in response to a single call to - * #GtkWidgetClass.get_preferred_height_for_width(). Returning a perfect height for width that - * is larger than the screen area is inconsequential since after the layouting receives an - * allocation from a scrolled window it simply continues to drive the the scrollbar - * values while more and mode height is required for the row heights that are calculated - * in the background. + * Note that in the above example we would need to cache the heights + * returned for each row so that we would know what sizes to render the + * areas for each row. However we would only want to really cache the + * heights if the request is intended for the layouting widgets real + * allocation. + * + * In some cases the layouting widget is requested the height for an + * arbitrary for_width, this is a special case for layouting widgets + * who need to request size for tens of thousands of rows. For this + * case it's only important that the layouting widget calculate + * one reasonably sized chunk of rows and return that height + * synchronously. The reasoning here is that any layouting widget is + * at least capable of synchronously calculating enough height to fill + * the screen height (or scrolled window height) in response to a single + * call to #GtkWidgetClass.get_preferred_height_for_width(). Returning + * a perfect height for width that is larger than the screen area is + * inconsequential since after the layouting receives an allocation + * from a scrolled window it simply continues to drive the the scrollbar + * values while more and more height is required for the row heights + * that are calculated in the background. * * * * Rendering Areas * - * Once area sizes have been aquired at least for the rows in the visible area of the - * layouting widget they can be rendered at #GtkWidgetClass.draw() time. + * Once area sizes have been aquired at least for the rows in the + * visible area of the layouting widget they can be rendered at + * #GtkWidgetClass.draw() time. * - * A crued example of how to render all the rows at the root level runs as follows: + * A crude example of how to render all the rows at the root level + * runs as follows: * - * Requesting the width of a hand full of GtkTreeModel rows. + * Requesting the width of a handful of GtkTreeModel rows * * GtkAllocation allocation; * GdkRectangle cell_area = { 0, }; @@ -206,7 +217,7 @@ * cell_area.height = get_cached_height_for_row (&iter); * * gtk_cell_area_apply_attributes (area, model, &iter, FALSE, FALSE); - * gtk_cell_area_render (area, context, widget, cr, + * gtk_cell_area_render (area, context, widget, cr, * &cell_area, &cell_area, state_flags, FALSE); * * cell_area.y += cell_area.height; @@ -215,42 +226,46 @@ * } * * - * Note that the cached height in this example really depends on how the layouting - * widget works. The layouting widget might decide to give every row it's minimum - * or natural height or if the model content is expected to fit inside the layouting - * widget with no scrolled window it would make sense to calculate the allocation - * for each row at #GtkWidget.size_allocate() time using gtk_distribute_natural_allocation(). + * Note that the cached height in this example really depends on how + * the layouting widget works. The layouting widget might decide to + * give every row it's minimum or natural height or, if the model content + * is expected to fit inside the layouting widget without scrolling, it + * would make sense to calculate the allocation for each row at + * #GtkWidget.size_allocate() time using gtk_distribute_natural_allocation(). * * * * Handling Events and Driving Keyboard Focus * - * Passing events to the area is as simple as handling events on any normal - * widget and then passing them to the gtk_cell_area_event() api as they come - * in. Usually #GtkCellArea is only interested in button events, however some - * customized derived areas can be implemented who are interested in handling - * other events. Handling an event can trigger the #GtkCellArea::focus-changed - * signal to fire as well as #GtkCellArea::add-editable in the case that - * an editable cell was clicked and needs to start editing. You can call + * Passing events to the area is as simple as handling events on any + * normal widget and then passing them to the gtk_cell_area_event() + * API as they come in. Usually #GtkCellArea is only interested in + * button events, however some customized derived areas can be implemented + * who are interested in handling other events. Handling an event can + * trigger the #GtkCellArea::focus-changed signal to fire; as well as + * #GtkCellArea::add-editable in the case that an editable cell was + * clicked and needs to start editing. You can call * gtk_cell_area_stop_editing() at any time to cancel any cell editing * that is currently in progress. * - * The #GtkCellArea drives keyboard focus from cell to cell in a way similar - * to #GtkWidget. For layouting widgets that support giving focus to cells it's - * important to remember to pass %GTK_CELL_RENDERER_FOCUSED to the area functions - * for the row that has focus and to tell the area to paint the focus at render - * time. - * - * Layouting widgets that accept focus on cells should implement the #GtkWidgetClass.focus() - * virtual method. The layouting widget is always responsible for knowing where - * #GtkTreeModel rows are rendered inside the widget, so at #GtkWidgetClass.focus() time - * the layouting widget should use the #GtkCellArea methods to navigate focus inside the - * area and then observe the GtkDirectionType to pass the focus to adjacent rows and - * areas. - * - * A basic example of how the #GtkWidgetClass.focus() virtual method should be implemented: + * The #GtkCellArea drives keyboard focus from cell to cell in a way + * similar to #GtkWidget. For layouting widgets that support giving + * focus to cells it's important to remember to pass %GTK_CELL_RENDERER_FOCUSED + * to the area functions for the row that has focus and to tell the + * area to paint the focus at render time. + * + * Layouting widgets that accept focus on cells should implement the + * #GtkWidgetClass.focus() virtual method. The layouting widget is always + * responsible for knowing where #GtkTreeModel rows are rendered inside + * the widget, so at #GtkWidgetClass.focus() time the layouting widget + * should use the #GtkCellArea methods to navigate focus inside the area + * and then observe the GtkDirectionType to pass the focus to adjacent + * rows and areas. + * + * A basic example of how the #GtkWidgetClass.focus() virtual method + * should be implemented: * - * Implementing keyboard focus navigation when displaying rows from top to bottom. + * Implementing keyboard focus navigation * * static gboolean * foo_focus (GtkWidget *widget, @@ -309,31 +324,34 @@ * } * * + * Note that the layouting widget is responsible for matching the + * GtkDirectionType values to the way it lays out its cells. * * * * Cell Properties * - * The #GtkCellArea introduces cell properties for #GtkCellRenderers in very - * much the same way that #GtkContainer introduces child properties - * for #GtkWidgets. This provides some general interfaces for defining the relationship cell areas - * have with their cells. For instance in a #GtkCellAreaBox a cell might "expand" and recieve extra - * space when the area is allocated more than it's full natural request, or a cell might be configured - * to "align" with adjacent rows which were requested and rendered with the same #GtkCellAreaContext. - * - * Use gtk_cell_area_class_install_cell_property() to install cell properties - * for a cell area class and gtk_cell_area_class_find_cell_property() or - * gtk_cell_area_class_list_cell_properties() to get information about existing - * cell properties. + * The #GtkCellArea introduces cell properties + * for #GtkCellRenderers in very much the same way that #GtkContainer + * introduces child properties + * for #GtkWidgets. This provides some general interfaces for defining + * the relationship cell areas have with their cells. For instance in a + * #GtkCellAreaBox a cell might "expand" and receive extra space when + * the area is allocated more than it's full natural request, or a cell + * might be configured to "align" with adjacent rows which were requested + * and rendered with the same #GtkCellAreaContext. + * + * Use gtk_cell_area_class_install_cell_property() to install cell + * properties for a cell area class and gtk_cell_area_class_find_cell_property() + * or gtk_cell_area_class_list_cell_properties() to get information about + * existing cell properties. * * To set the value of a cell property, use gtk_cell_area_cell_set_property(), - * gtk_cell_area_cell_set() or gtk_cell_area_cell_set_valist(). - * To obtain the value of a cell property, use - * gtk_cell_area_cell_get_property(), gtk_cell_area_cell_get() or - * gtk_cell_area_cell_get_valist(). + * gtk_cell_area_cell_set() or gtk_cell_area_cell_set_valist(). To obtain + * the value of a cell property, use gtk_cell_area_cell_get_property(), + * gtk_cell_area_cell_get() or gtk_cell_area_cell_get_valist(). * * - * */ #include "config.h" @@ -356,84 +374,84 @@ static void gtk_cell_area_dispose (GObject *object); static void gtk_cell_area_finalize (GObject *object); static void gtk_cell_area_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); + guint prop_id, + const GValue *value, + GParamSpec *pspec); static void gtk_cell_area_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); + guint prop_id, + GValue *value, + GParamSpec *pspec); /* GtkCellAreaClass */ static gint gtk_cell_area_real_event (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - GdkEvent *event, - const GdkRectangle *cell_area, - GtkCellRendererState flags); + GtkCellAreaContext *context, + GtkWidget *widget, + GdkEvent *event, + const GdkRectangle *cell_area, + GtkCellRendererState flags); static void gtk_cell_area_real_render (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - cairo_t *cr, - const GdkRectangle *background_area, - const GdkRectangle *cell_area, - GtkCellRendererState flags, - gboolean paint_focus); + GtkCellAreaContext *context, + GtkWidget *widget, + cairo_t *cr, + const GdkRectangle *background_area, + const GdkRectangle *cell_area, + GtkCellRendererState flags, + gboolean paint_focus); static void gtk_cell_area_real_apply_attributes (GtkCellArea *area, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gboolean is_expander, - gboolean is_expanded); + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gboolean is_expander, + gboolean is_expanded); static void gtk_cell_area_real_get_preferred_height_for_width (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint width, - gint *minimum_height, - gint *natural_height); + GtkCellAreaContext *context, + GtkWidget *widget, + gint width, + gint *minimum_height, + gint *natural_height); static void gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint height, - gint *minimum_width, - gint *natural_width); + GtkCellAreaContext *context, + GtkWidget *widget, + gint height, + gint *minimum_width, + gint *natural_width); static gboolean gtk_cell_area_real_is_activatable (GtkCellArea *area); static gboolean gtk_cell_area_real_activate (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - GtkCellRendererState flags, - gboolean edit_only); + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + GtkCellRendererState flags, + gboolean edit_only); /* GtkCellLayoutIface */ static void gtk_cell_area_cell_layout_init (GtkCellLayoutIface *iface); static void gtk_cell_area_pack_default (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer, - gboolean expand); + GtkCellRenderer *renderer, + gboolean expand); static void gtk_cell_area_clear (GtkCellLayout *cell_layout); static void gtk_cell_area_add_attribute (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer, - const gchar *attribute, - gint column); + GtkCellRenderer *renderer, + const gchar *attribute, + gint column); static void gtk_cell_area_set_cell_data_func (GtkCellLayout *cell_layout, - GtkCellRenderer *cell, - GtkCellLayoutDataFunc func, - gpointer func_data, - GDestroyNotify destroy); + GtkCellRenderer *cell, + GtkCellLayoutDataFunc func, + gpointer func_data, + GDestroyNotify destroy); static void gtk_cell_area_clear_attributes (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); static void gtk_cell_area_reorder (GtkCellLayout *cell_layout, - GtkCellRenderer *cell, - gint position); + GtkCellRenderer *cell, + gint position); static GList *gtk_cell_area_get_cells (GtkCellLayout *cell_layout); static GtkCellArea *gtk_cell_area_get_area (GtkCellLayout *cell_layout); /* GtkBuildableIface */ static void gtk_cell_area_buildable_init (GtkBuildableIface *iface); static void gtk_cell_area_buildable_custom_tag_end (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const gchar *tagname, - gpointer *data); + GtkBuilder *builder, + GObject *child, + const gchar *tagname, + gpointer *data); /* Used in foreach loop to check if a child renderer is present */ typedef struct { @@ -482,31 +500,31 @@ typedef struct { } CellInfo; static CellInfo *cell_info_new (GtkCellLayoutDataFunc func, - gpointer data, - GDestroyNotify destroy); + gpointer data, + GDestroyNotify destroy); static void cell_info_free (CellInfo *info); static CellAttribute *cell_attribute_new (GtkCellRenderer *renderer, - const gchar *attribute, - gint column); + const gchar *attribute, + gint column); static void cell_attribute_free (CellAttribute *attribute); static gint cell_attribute_find (CellAttribute *cell_attribute, - const gchar *attribute); + const gchar *attribute); /* Internal functions/signal emissions */ static void gtk_cell_area_add_editable (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkCellEditable *editable, - const GdkRectangle *cell_area); + GtkCellRenderer *renderer, + GtkCellEditable *editable, + const GdkRectangle *cell_area); static void gtk_cell_area_remove_editable (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkCellEditable *editable); + GtkCellRenderer *renderer, + GtkCellEditable *editable); static void gtk_cell_area_set_edit_widget (GtkCellArea *area, - GtkCellEditable *editable); + GtkCellEditable *editable); static void gtk_cell_area_set_edited_cell (GtkCellArea *area, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); -/* Struct to pass data along while looping over +/* Struct to pass data along while looping over * cell renderers to apply attributes */ typedef struct { @@ -519,13 +537,14 @@ typedef struct { struct _GtkCellAreaPrivate { - /* The GtkCellArea bookkeeps any connected + /* The GtkCellArea bookkeeps any connected * attributes in this hash table. */ GHashTable *cell_info; /* Current path is saved as a side-effect - * of gtk_cell_area_apply_attributes() */ + * of gtk_cell_area_apply_attributes() + */ gchar *current_path; /* Current cell being edited and editable widget used */ @@ -561,7 +580,8 @@ enum { }; /* Keep the paramspec pool internal, no need to deliver notifications - * on cells. at least no percieved need for now */ + * on cells. at least no perceived need for now + */ static GParamSpecPool *cell_property_pool = NULL; static guint cell_area_signals[LAST_SIGNAL] = { 0 }; @@ -569,10 +589,10 @@ static guint cell_area_signals[LAST_SIGNAL] = { 0 }; #define PARAM_SPEC_SET_PARAM_ID(pspec, id) ((pspec)->param_id = (id)) G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkCellArea, gtk_cell_area, G_TYPE_INITIALLY_UNOWNED, - G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT, - gtk_cell_area_cell_layout_init) - G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, - gtk_cell_area_buildable_init)) + G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT, + gtk_cell_area_cell_layout_init) + G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, + gtk_cell_area_buildable_init)) static void gtk_cell_area_init (GtkCellArea *area) @@ -580,19 +600,19 @@ gtk_cell_area_init (GtkCellArea *area) GtkCellAreaPrivate *priv; area->priv = G_TYPE_INSTANCE_GET_PRIVATE (area, - GTK_TYPE_CELL_AREA, - GtkCellAreaPrivate); + GTK_TYPE_CELL_AREA, + GtkCellAreaPrivate); priv = area->priv; - priv->cell_info = g_hash_table_new_full (g_direct_hash, - g_direct_equal, - NULL, - (GDestroyNotify)cell_info_free); + priv->cell_info = g_hash_table_new_full (g_direct_hash, + g_direct_equal, + NULL, + (GDestroyNotify)cell_info_free); - priv->focus_siblings = g_hash_table_new_full (g_direct_hash, - g_direct_equal, - NULL, - (GDestroyNotify)g_list_free); + priv->focus_siblings = g_hash_table_new_full (g_direct_hash, + g_direct_equal, + NULL, + (GDestroyNotify)g_list_free); priv->focus_cell = NULL; priv->edited_cell = NULL; @@ -601,11 +621,11 @@ gtk_cell_area_init (GtkCellArea *area) priv->remove_widget_id = 0; } -static void +static void gtk_cell_area_class_init (GtkCellAreaClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - + /* GObjectClass */ object_class->dispose = gtk_cell_area_dispose; object_class->finalize = gtk_cell_area_finalize; @@ -648,16 +668,16 @@ gtk_cell_area_class_init (GtkCellAreaClass *class) */ cell_area_signals[SIGNAL_APPLY_ATTRIBUTES] = g_signal_new (I_("apply-attributes"), - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GtkCellAreaClass, apply_attributes), - NULL, NULL, - _gtk_marshal_VOID__OBJECT_BOXED_BOOLEAN_BOOLEAN, - G_TYPE_NONE, 4, - GTK_TYPE_TREE_MODEL, - GTK_TYPE_TREE_ITER, - G_TYPE_BOOLEAN, - G_TYPE_BOOLEAN); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkCellAreaClass, apply_attributes), + NULL, NULL, + _gtk_marshal_VOID__OBJECT_BOXED_BOOLEAN_BOOLEAN, + G_TYPE_NONE, 4, + GTK_TYPE_TREE_MODEL, + GTK_TYPE_TREE_ITER, + G_TYPE_BOOLEAN, + G_TYPE_BOOLEAN); /** * GtkCellArea::add-editable: @@ -675,16 +695,16 @@ gtk_cell_area_class_init (GtkCellAreaClass *class) */ cell_area_signals[SIGNAL_ADD_EDITABLE] = g_signal_new (I_("add-editable"), - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, /* No class closure here */ - NULL, NULL, - _gtk_marshal_VOID__OBJECT_OBJECT_BOXED_STRING, - G_TYPE_NONE, 4, - GTK_TYPE_CELL_RENDERER, - GTK_TYPE_CELL_EDITABLE, - GDK_TYPE_RECTANGLE, - G_TYPE_STRING); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, /* No class closure here */ + NULL, NULL, + _gtk_marshal_VOID__OBJECT_OBJECT_BOXED_STRING, + G_TYPE_NONE, 4, + GTK_TYPE_CELL_RENDERER, + GTK_TYPE_CELL_EDITABLE, + GDK_TYPE_RECTANGLE, + G_TYPE_STRING); /** @@ -700,14 +720,14 @@ gtk_cell_area_class_init (GtkCellAreaClass *class) */ cell_area_signals[SIGNAL_REMOVE_EDITABLE] = g_signal_new (I_("remove-editable"), - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, /* No class closure here */ - NULL, NULL, - _gtk_marshal_VOID__OBJECT_OBJECT, - G_TYPE_NONE, 2, - GTK_TYPE_CELL_RENDERER, - GTK_TYPE_CELL_EDITABLE); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, /* No class closure here */ + NULL, NULL, + _gtk_marshal_VOID__OBJECT_OBJECT, + G_TYPE_NONE, 2, + GTK_TYPE_CELL_RENDERER, + GTK_TYPE_CELL_EDITABLE); /** * GtkCellArea::focus-changed: @@ -728,14 +748,14 @@ gtk_cell_area_class_init (GtkCellAreaClass *class) */ cell_area_signals[SIGNAL_FOCUS_CHANGED] = g_signal_new (I_("focus-changed"), - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, /* No class closure here */ - NULL, NULL, - _gtk_marshal_VOID__OBJECT_STRING, - G_TYPE_NONE, 2, - GTK_TYPE_CELL_RENDERER, - G_TYPE_STRING); + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + 0, /* No class closure here */ + NULL, NULL, + _gtk_marshal_VOID__OBJECT_STRING, + G_TYPE_NONE, 2, + GTK_TYPE_CELL_RENDERER, + G_TYPE_STRING); /* Properties */ /** @@ -748,11 +768,11 @@ gtk_cell_area_class_init (GtkCellAreaClass *class) g_object_class_install_property (object_class, PROP_FOCUS_CELL, g_param_spec_object - ("focus-cell", - P_("Focus Cell"), - P_("The cell which currently has focus"), - GTK_TYPE_CELL_RENDERER, - GTK_PARAM_READWRITE)); + ("focus-cell", + P_("Focus Cell"), + P_("The cell which currently has focus"), + GTK_TYPE_CELL_RENDERER, + GTK_PARAM_READWRITE)); /** * GtkCellArea:edited-cell: @@ -767,11 +787,11 @@ gtk_cell_area_class_init (GtkCellAreaClass *class) g_object_class_install_property (object_class, PROP_EDITED_CELL, g_param_spec_object - ("edited-cell", - P_("Edited Cell"), - P_("The cell which is currently being edited"), - GTK_TYPE_CELL_RENDERER, - G_PARAM_READABLE)); + ("edited-cell", + P_("Edited Cell"), + P_("The cell which is currently being edited"), + GTK_TYPE_CELL_RENDERER, + G_PARAM_READABLE)); /** * GtkCellArea:edit-widget: @@ -786,11 +806,11 @@ gtk_cell_area_class_init (GtkCellAreaClass *class) g_object_class_install_property (object_class, PROP_EDIT_WIDGET, g_param_spec_object - ("edit-widget", - P_("Edit Widget"), - P_("The widget currently editing the edited cell"), - GTK_TYPE_CELL_RENDERER, - G_PARAM_READABLE)); + ("edit-widget", + P_("Edit Widget"), + P_("The widget currently editing the edited cell"), + GTK_TYPE_CELL_RENDERER, + G_PARAM_READABLE)); /* Pool for Cell Properties */ if (!cell_property_pool) @@ -804,8 +824,8 @@ gtk_cell_area_class_init (GtkCellAreaClass *class) *************************************************************/ static CellInfo * cell_info_new (GtkCellLayoutDataFunc func, - gpointer data, - GDestroyNotify destroy) + gpointer data, + GDestroyNotify destroy) { CellInfo *info = g_slice_new0 (CellInfo); @@ -830,14 +850,14 @@ cell_info_free (CellInfo *info) static CellAttribute * cell_attribute_new (GtkCellRenderer *renderer, - const gchar *attribute, - gint column) + const gchar *attribute, + gint column) { GParamSpec *pspec; /* Check if the attribute really exists and point to * the property string installed on the cell renderer - * class (dont dup the string) + * class (dont dup the string) */ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (renderer), attribute); @@ -863,7 +883,7 @@ cell_attribute_free (CellAttribute *attribute) /* GCompareFunc for g_slist_find_custom() */ static gint cell_attribute_find (CellAttribute *cell_attribute, - const gchar *attribute) + const gchar *attribute) { return g_strcmp0 (cell_attribute->attribute, attribute); } @@ -878,7 +898,7 @@ gtk_cell_area_finalize (GObject *object) GtkCellAreaPrivate *priv = area->priv; /* All cell renderers should already be removed at this point, - * just kill our (empty) hash tables here. + * just kill our (empty) hash tables here. */ g_hash_table_destroy (priv->cell_info); g_hash_table_destroy (priv->focus_siblings); @@ -893,7 +913,7 @@ static void gtk_cell_area_dispose (GObject *object) { /* This removes every cell renderer that may be added to the GtkCellArea, - * subclasses should be breaking references to the GtkCellRenderers + * subclasses should be breaking references to the GtkCellRenderers * at this point. */ gtk_cell_layout_clear (GTK_CELL_LAYOUT (object)); @@ -908,9 +928,9 @@ gtk_cell_area_dispose (GObject *object) static void gtk_cell_area_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) + guint prop_id, + const GValue *value, + GParamSpec *pspec) { GtkCellArea *area = GTK_CELL_AREA (object); @@ -927,9 +947,9 @@ gtk_cell_area_set_property (GObject *object, static void gtk_cell_area_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) + guint prop_id, + GValue *value, + GParamSpec *pspec) { GtkCellArea *area = GTK_CELL_AREA (object); GtkCellAreaPrivate *priv = area->priv; @@ -956,11 +976,11 @@ gtk_cell_area_get_property (GObject *object, *************************************************************/ static gint gtk_cell_area_real_event (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - GdkEvent *event, - const GdkRectangle *cell_area, - GtkCellRendererState flags) + GtkCellAreaContext *context, + GtkWidget *widget, + GdkEvent *event, + const GdkRectangle *cell_area, + GtkCellRendererState flags) { GtkCellAreaPrivate *priv = area->priv; gboolean retval = FALSE; @@ -971,65 +991,65 @@ gtk_cell_area_real_event (GtkCellArea *area, /* Cancel any edits in progress */ if (priv->edited_cell && (key_event->keyval == GDK_KEY_Escape)) - { - gtk_cell_area_stop_editing (area, TRUE); - retval = TRUE; - } + { + gtk_cell_area_stop_editing (area, TRUE); + retval = TRUE; + } } else if (event->type == GDK_BUTTON_PRESS) { GdkEventButton *button_event = (GdkEventButton *)event; if (button_event->button == 1) - { - GtkCellRenderer *renderer = NULL; - GtkCellRenderer *focus_renderer; - GdkRectangle alloc_area; - gint event_x, event_y; - - /* We may need some semantics to tell us the offset of the event - * window we are handling events for (i.e. GtkTreeView has a bin_window) */ - event_x = button_event->x; - event_y = button_event->y; - - /* Dont try to search for an event coordinate that is not in the area, that will - * trigger a runtime warning. - */ - if (event_x >= cell_area->x && event_x <= cell_area->x + cell_area->width && - event_y >= cell_area->y && event_y <= cell_area->y + cell_area->height) - renderer = - gtk_cell_area_get_cell_at_position (area, context, widget, - cell_area, event_x, event_y, - &alloc_area); - - if (renderer) - { - focus_renderer = gtk_cell_area_get_focus_from_sibling (area, renderer); - if (!focus_renderer) - focus_renderer = renderer; - - /* If we're already editing, cancel it and set focus */ - if (gtk_cell_area_get_edited_cell (area)) - { - /* XXX Was it really canceled in this case ? */ - gtk_cell_area_stop_editing (area, TRUE); - gtk_cell_area_set_focus_cell (area, focus_renderer); - retval = TRUE; - } - else - { - /* If we are activating via a focus sibling, - * we need to fetch the right cell area for the real event renderer */ - if (focus_renderer != renderer) - gtk_cell_area_get_cell_allocation (area, context, widget, focus_renderer, - cell_area, &alloc_area); - - gtk_cell_area_set_focus_cell (area, focus_renderer); - retval = gtk_cell_area_activate_cell (area, widget, focus_renderer, - event, &alloc_area, flags); - } - } - } + { + GtkCellRenderer *renderer = NULL; + GtkCellRenderer *focus_renderer; + GdkRectangle alloc_area; + gint event_x, event_y; + + /* We may need some semantics to tell us the offset of the event + * window we are handling events for (i.e. GtkTreeView has a bin_window) */ + event_x = button_event->x; + event_y = button_event->y; + + /* Dont try to search for an event coordinate that is not in the area, that will + * trigger a runtime warning. + */ + if (event_x >= cell_area->x && event_x <= cell_area->x + cell_area->width && + event_y >= cell_area->y && event_y <= cell_area->y + cell_area->height) + renderer = + gtk_cell_area_get_cell_at_position (area, context, widget, + cell_area, event_x, event_y, + &alloc_area); + + if (renderer) + { + focus_renderer = gtk_cell_area_get_focus_from_sibling (area, renderer); + if (!focus_renderer) + focus_renderer = renderer; + + /* If we're already editing, cancel it and set focus */ + if (gtk_cell_area_get_edited_cell (area)) + { + /* XXX Was it really canceled in this case ? */ + gtk_cell_area_stop_editing (area, TRUE); + gtk_cell_area_set_focus_cell (area, focus_renderer); + retval = TRUE; + } + else + { + /* If we are activating via a focus sibling, + * we need to fetch the right cell area for the real event renderer */ + if (focus_renderer != renderer) + gtk_cell_area_get_cell_allocation (area, context, widget, focus_renderer, + cell_area, &alloc_area); + + gtk_cell_area_set_focus_cell (area, focus_renderer); + retval = gtk_cell_area_activate_cell (area, widget, focus_renderer, + event, &alloc_area, flags); + } + } + } } return retval; @@ -1037,9 +1057,9 @@ gtk_cell_area_real_event (GtkCellArea *area, static gboolean render_cell (GtkCellRenderer *renderer, - const GdkRectangle *cell_area, - const GdkRectangle *cell_background, - CellRenderData *data) + const GdkRectangle *cell_area, + const GdkRectangle *cell_background, + CellRenderData *data) { GtkCellRenderer *focus_cell; GtkCellRendererState flags; @@ -1051,10 +1071,10 @@ render_cell (GtkCellRenderer *renderer, gtk_cell_area_inner_cell_area (data->area, data->widget, cell_area, &inner_area); if ((flags & GTK_CELL_RENDERER_FOCUSED) && - (data->focus_all || - (focus_cell && - (renderer == focus_cell || - gtk_cell_area_is_focus_sibling (data->area, focus_cell, renderer))))) + (data->focus_all || + (focus_cell && + (renderer == focus_cell || + gtk_cell_area_is_focus_sibling (data->area, focus_cell, renderer))))) { gint focus_line_width; GdkRectangle cell_focus; @@ -1072,79 +1092,79 @@ render_cell (GtkCellRenderer *renderer, cell_focus.height += 2 * focus_line_width; if (data->first_focus) - { - data->first_focus = FALSE; - data->focus_rect = cell_focus; - } + { + data->first_focus = FALSE; + data->focus_rect = cell_focus; + } else - { - gdk_rectangle_union (&data->focus_rect, &cell_focus, &data->focus_rect); - } + { + gdk_rectangle_union (&data->focus_rect, &cell_focus, &data->focus_rect); + } } else flags &= ~GTK_CELL_RENDERER_FOCUSED; gtk_cell_renderer_render (renderer, data->cr, data->widget, - cell_background, &inner_area, flags); + cell_background, &inner_area, flags); return FALSE; } static void gtk_cell_area_real_render (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - cairo_t *cr, - const GdkRectangle *background_area, - const GdkRectangle *cell_area, - GtkCellRendererState flags, - gboolean paint_focus) -{ - CellRenderData render_data = - { - area, - widget, - cr, - { 0, }, - flags, - paint_focus, + GtkCellAreaContext *context, + GtkWidget *widget, + cairo_t *cr, + const GdkRectangle *background_area, + const GdkRectangle *cell_area, + GtkCellRendererState flags, + gboolean paint_focus) +{ + CellRenderData render_data = + { + area, + widget, + cr, + { 0, }, + flags, + paint_focus, FALSE, TRUE }; /* Make sure we dont paint a focus rectangle while there - * is an editable widget in play + * is an editable widget in play */ if (gtk_cell_area_get_edited_cell (area)) render_data.paint_focus = FALSE; /* If no cell can activate but the caller wants focus painted, * then we paint focus around all cells */ - if ((flags & GTK_CELL_RENDERER_FOCUSED) != 0 && paint_focus && + if ((flags & GTK_CELL_RENDERER_FOCUSED) != 0 && paint_focus && !gtk_cell_area_is_activatable (area)) render_data.focus_all = TRUE; - gtk_cell_area_foreach_alloc (area, context, widget, cell_area, background_area, - (GtkCellAllocCallback)render_cell, &render_data); + gtk_cell_area_foreach_alloc (area, context, widget, cell_area, background_area, + (GtkCellAllocCallback)render_cell, &render_data); - if (render_data.paint_focus && - render_data.focus_rect.width != 0 && + if (render_data.paint_focus && + render_data.focus_rect.width != 0 && render_data.focus_rect.height != 0) { - GtkStateType renderer_state = - flags & GTK_CELL_RENDERER_SELECTED ? GTK_STATE_SELECTED : - (flags & GTK_CELL_RENDERER_PRELIT ? GTK_STATE_PRELIGHT : - (flags & GTK_CELL_RENDERER_INSENSITIVE ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL)); + GtkStateType renderer_state = + flags & GTK_CELL_RENDERER_SELECTED ? GTK_STATE_SELECTED : + (flags & GTK_CELL_RENDERER_PRELIT ? GTK_STATE_PRELIGHT : + (flags & GTK_CELL_RENDERER_INSENSITIVE ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL)); cairo_save (cr); gdk_cairo_rectangle (cr, background_area); cairo_clip (cr); - gtk_paint_focus (gtk_widget_get_style (widget), cr, - renderer_state, widget, - gtk_cell_area_get_style_detail (area), - render_data.focus_rect.x, render_data.focus_rect.y, - render_data.focus_rect.width, render_data.focus_rect.height); + gtk_paint_focus (gtk_widget_get_style (widget), cr, + renderer_state, widget, + gtk_cell_area_get_style_detail (area), + render_data.focus_rect.x, render_data.focus_rect.y, + render_data.focus_rect.width, render_data.focus_rect.height); cairo_restore (cr); } @@ -1152,8 +1172,8 @@ gtk_cell_area_real_render (GtkCellArea *area, static void apply_cell_attributes (GtkCellRenderer *renderer, - CellInfo *info, - AttributeData *data) + CellInfo *info, + AttributeData *data) { CellAttribute *attribute; GSList *list; @@ -1163,14 +1183,14 @@ apply_cell_attributes (GtkCellRenderer *renderer, g_object_freeze_notify (G_OBJECT (renderer)); - /* Whether a row expands or is presently expanded can only be + /* Whether a row expands or is presently expanded can only be * provided by the view (as these states can vary across views * accessing the same model). */ g_object_get (renderer, "is-expander", &is_expander, NULL); if (is_expander != data->is_expander) g_object_set (renderer, "is-expander", data->is_expander, NULL); - + g_object_get (renderer, "is-expanded", &is_expanded, NULL); if (is_expanded != data->is_expanded) g_object_set (renderer, "is-expanded", data->is_expanded, NULL); @@ -1189,17 +1209,17 @@ apply_cell_attributes (GtkCellRenderer *renderer, */ if (info->func) info->func (GTK_CELL_LAYOUT (data->area), renderer, - data->model, data->iter, info->data); + data->model, data->iter, info->data); g_object_thaw_notify (G_OBJECT (renderer)); } static void gtk_cell_area_real_apply_attributes (GtkCellArea *area, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gboolean is_expander, - gboolean is_expanded) + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gboolean is_expander, + gboolean is_expanded) { GtkCellAreaPrivate *priv; @@ -1228,11 +1248,11 @@ gtk_cell_area_real_apply_attributes (GtkCellArea *area, static void gtk_cell_area_real_get_preferred_height_for_width (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint width, - gint *minimum_height, - gint *natural_height) + GtkCellAreaContext *context, + GtkWidget *widget, + gint width, + gint *minimum_height, + gint *natural_height) { /* If the area doesnt do height-for-width, fallback on base preferred height */ GTK_CELL_AREA_GET_CLASS (area)->get_preferred_width (area, context, widget, minimum_height, natural_height); @@ -1240,11 +1260,11 @@ gtk_cell_area_real_get_preferred_height_for_width (GtkCellArea *area, static void gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint height, - gint *minimum_width, - gint *natural_width) + GtkCellAreaContext *context, + GtkWidget *widget, + gint height, + gint *minimum_width, + gint *natural_width) { /* If the area doesnt do width-for-height, fallback on base preferred width */ GTK_CELL_AREA_GET_CLASS (area)->get_preferred_width (area, context, widget, minimum_width, natural_width); @@ -1252,7 +1272,7 @@ gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea *area, static gboolean get_is_activatable (GtkCellRenderer *renderer, - gboolean *activatable) + gboolean *activatable) { if (gtk_cell_renderer_is_activatable (renderer)) @@ -1279,11 +1299,11 @@ gtk_cell_area_real_is_activatable (GtkCellArea *area) static gboolean gtk_cell_area_real_activate (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - GtkCellRendererState flags, - gboolean edit_only) + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + GtkCellRendererState flags, + gboolean edit_only) { GtkCellAreaPrivate *priv = area->priv; GdkRectangle renderer_area; @@ -1295,9 +1315,9 @@ gtk_cell_area_real_activate (GtkCellArea *area, g_object_get (priv->focus_cell, "mode", &mode, NULL); if (gtk_cell_renderer_get_visible (priv->focus_cell) && - (edit_only ? mode == GTK_CELL_RENDERER_MODE_EDITABLE : - mode != GTK_CELL_RENDERER_MODE_INERT)) - activate_cell = priv->focus_cell; + (edit_only ? mode == GTK_CELL_RENDERER_MODE_EDITABLE : + mode != GTK_CELL_RENDERER_MODE_INERT)) + activate_cell = priv->focus_cell; } else { @@ -1308,16 +1328,16 @@ gtk_cell_area_real_activate (GtkCellArea *area, */ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (area)); for (l = cells; l && !activate_cell; l = l->next) - { - GtkCellRenderer *renderer = l->data; + { + GtkCellRenderer *renderer = l->data; - g_object_get (renderer, "mode", &mode, NULL); + g_object_get (renderer, "mode", &mode, NULL); - if (gtk_cell_renderer_get_visible (renderer) && - (edit_only ? mode == GTK_CELL_RENDERER_MODE_EDITABLE : - mode != GTK_CELL_RENDERER_MODE_INERT)) - activate_cell = renderer; - } + if (gtk_cell_renderer_get_visible (renderer) && + (edit_only ? mode == GTK_CELL_RENDERER_MODE_EDITABLE : + mode != GTK_CELL_RENDERER_MODE_INERT)) + activate_cell = renderer; + } g_list_free (cells); } @@ -1326,16 +1346,16 @@ gtk_cell_area_real_activate (GtkCellArea *area, /* Get the allocation of the focused cell. */ gtk_cell_area_get_cell_allocation (area, context, widget, activate_cell, - cell_area, &renderer_area); - + cell_area, &renderer_area); + /* Activate or Edit the cell * * Currently just not sending an event, renderers afaics dont use * the event argument anyway, worst case is we can synthesize one. */ if (gtk_cell_area_activate_cell (area, widget, activate_cell, NULL, - &renderer_area, flags)) - return TRUE; + &renderer_area, flags)) + return TRUE; } return FALSE; @@ -1360,8 +1380,8 @@ gtk_cell_area_cell_layout_init (GtkCellLayoutIface *iface) static void gtk_cell_area_pack_default (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer, - gboolean expand) + GtkCellRenderer *renderer, + gboolean expand) { gtk_cell_area_add (GTK_CELL_AREA (cell_layout), renderer); } @@ -1384,20 +1404,20 @@ gtk_cell_area_clear (GtkCellLayout *cell_layout) static void gtk_cell_area_add_attribute (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer, - const gchar *attribute, - gint column) + GtkCellRenderer *renderer, + const gchar *attribute, + gint column) { gtk_cell_area_attribute_connect (GTK_CELL_AREA (cell_layout), - renderer, attribute, column); + renderer, attribute, column); } static void gtk_cell_area_set_cell_data_func (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer, - GtkCellLayoutDataFunc func, - gpointer func_data, - GDestroyNotify destroy) + GtkCellRenderer *renderer, + GtkCellLayoutDataFunc func, + gpointer func_data, + GDestroyNotify destroy) { GtkCellArea *area = GTK_CELL_AREA (cell_layout); GtkCellAreaPrivate *priv = area->priv; @@ -1408,20 +1428,20 @@ gtk_cell_area_set_cell_data_func (GtkCellLayout *cell_layout, if (info) { if (info->destroy && info->data) - info->destroy (info->data); + info->destroy (info->data); if (func) - { - info->func = func; - info->data = func_data; - info->destroy = destroy; - } + { + info->func = func; + info->data = func_data; + info->destroy = destroy; + } else - { - info->func = NULL; - info->data = NULL; - info->destroy = NULL; - } + { + info->func = NULL; + info->data = NULL; + info->destroy = NULL; + } } else { @@ -1433,7 +1453,7 @@ gtk_cell_area_set_cell_data_func (GtkCellLayout *cell_layout, static void gtk_cell_area_clear_attributes (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer) + GtkCellRenderer *renderer) { GtkCellArea *area = GTK_CELL_AREA (cell_layout); GtkCellAreaPrivate *priv = area->priv; @@ -1450,18 +1470,18 @@ gtk_cell_area_clear_attributes (GtkCellLayout *cell_layout, } } -static void +static void gtk_cell_area_reorder (GtkCellLayout *cell_layout, - GtkCellRenderer *cell, - gint position) + GtkCellRenderer *cell, + gint position) { - g_warning ("GtkCellLayout::reorder not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (cell_layout))); + g_warning ("GtkCellLayout::reorder not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (cell_layout))); } static gboolean accum_cells (GtkCellRenderer *renderer, - GList **accum) + GList **accum) { *accum = g_list_prepend (*accum, renderer); @@ -1473,9 +1493,9 @@ gtk_cell_area_get_cells (GtkCellLayout *cell_layout) { GList *cells = NULL; - gtk_cell_area_foreach (GTK_CELL_AREA (cell_layout), - (GtkCellCallback)accum_cells, - &cells); + gtk_cell_area_foreach (GTK_CELL_AREA (cell_layout), + (GtkCellCallback)accum_cells, + &cells); return g_list_reverse (cells); } @@ -1499,10 +1519,10 @@ gtk_cell_area_buildable_init (GtkBuildableIface *iface) static void gtk_cell_area_buildable_custom_tag_end (GtkBuildable *buildable, - GtkBuilder *builder, - GObject *child, - const gchar *tagname, - gpointer *data) + GtkBuilder *builder, + GObject *child, + const gchar *tagname, + gpointer *data) { /* Just ignore the boolean return from here */ _gtk_cell_layout_buildable_custom_tag_end (buildable, builder, child, tagname, data); @@ -1523,7 +1543,7 @@ gtk_cell_area_buildable_custom_tag_end (GtkBuildable *buildable, */ void gtk_cell_area_add (GtkCellArea *area, - GtkCellRenderer *renderer) + GtkCellRenderer *renderer) { GtkCellAreaClass *class; @@ -1535,8 +1555,8 @@ gtk_cell_area_add (GtkCellArea *area, if (class->add) class->add (area, renderer); else - g_warning ("GtkCellAreaClass::add not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); + g_warning ("GtkCellAreaClass::add not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); } /** @@ -1550,7 +1570,7 @@ gtk_cell_area_add (GtkCellArea *area, */ void gtk_cell_area_remove (GtkCellArea *area, - GtkCellRenderer *renderer) + GtkCellRenderer *renderer) { GtkCellAreaClass *class; GtkCellAreaPrivate *priv; @@ -1568,7 +1588,7 @@ gtk_cell_area_remove (GtkCellArea *area, /* Remove focus siblings of this renderer */ g_hash_table_remove (priv->focus_siblings, renderer); - /* Remove this renderer from any focus renderer's sibling list */ + /* Remove this renderer from any focus renderer's sibling list */ renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (area)); for (l = renderers; l; l = l->next) @@ -1576,10 +1596,10 @@ gtk_cell_area_remove (GtkCellArea *area, GtkCellRenderer *focus_renderer = l->data; if (gtk_cell_area_is_focus_sibling (area, focus_renderer, renderer)) - { - gtk_cell_area_remove_focus_sibling (area, focus_renderer, renderer); - break; - } + { + gtk_cell_area_remove_focus_sibling (area, focus_renderer, renderer); + break; + } } g_list_free (renderers); @@ -1587,13 +1607,13 @@ gtk_cell_area_remove (GtkCellArea *area, if (class->remove) class->remove (area, renderer); else - g_warning ("GtkCellAreaClass::remove not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); + g_warning ("GtkCellAreaClass::remove not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); } static gboolean get_has_renderer (GtkCellRenderer *renderer, - HasRendererCheck *check) + HasRendererCheck *check) { if (renderer == check->renderer) check->has_renderer = TRUE; @@ -1614,7 +1634,7 @@ get_has_renderer (GtkCellRenderer *renderer, */ gboolean gtk_cell_area_has_renderer (GtkCellArea *area, - GtkCellRenderer *renderer) + GtkCellRenderer *renderer) { HasRendererCheck check = { renderer, FALSE }; @@ -1638,8 +1658,8 @@ gtk_cell_area_has_renderer (GtkCellArea *area, */ void gtk_cell_area_foreach (GtkCellArea *area, - GtkCellCallback callback, - gpointer callback_data) + GtkCellCallback callback, + gpointer callback_data) { GtkCellAreaClass *class; @@ -1651,8 +1671,8 @@ gtk_cell_area_foreach (GtkCellArea *area, if (class->foreach) class->foreach (area, callback, callback_data); else - g_warning ("GtkCellAreaClass::foreach not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); + g_warning ("GtkCellAreaClass::foreach not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); } /** @@ -1672,12 +1692,12 @@ gtk_cell_area_foreach (GtkCellArea *area, */ void gtk_cell_area_foreach_alloc (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - const GdkRectangle *background_area, - GtkCellAllocCallback callback, - gpointer callback_data) + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + const GdkRectangle *background_area, + GtkCellAllocCallback callback, + gpointer callback_data) { GtkCellAreaClass *class; @@ -1692,8 +1712,8 @@ gtk_cell_area_foreach_alloc (GtkCellArea *area, if (class->foreach_alloc) class->foreach_alloc (area, context, widget, cell_area, background_area, callback, callback_data); else - g_warning ("GtkCellAreaClass::foreach_alloc not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); + g_warning ("GtkCellAreaClass::foreach_alloc not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); } /** @@ -1713,11 +1733,11 @@ gtk_cell_area_foreach_alloc (GtkCellArea *area, */ gint gtk_cell_area_event (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - GdkEvent *event, - const GdkRectangle *cell_area, - GtkCellRendererState flags) + GtkCellAreaContext *context, + GtkWidget *widget, + GdkEvent *event, + const GdkRectangle *cell_area, + GtkCellRendererState flags) { GtkCellAreaClass *class; @@ -1732,8 +1752,8 @@ gtk_cell_area_event (GtkCellArea *area, if (class->event) return class->event (area, context, widget, event, cell_area, flags); - g_warning ("GtkCellAreaClass::event not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); + g_warning ("GtkCellAreaClass::event not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); return 0; } @@ -1755,13 +1775,13 @@ gtk_cell_area_event (GtkCellArea *area, */ void gtk_cell_area_render (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - cairo_t *cr, - const GdkRectangle *background_area, - const GdkRectangle *cell_area, - GtkCellRendererState flags, - gboolean paint_focus) + GtkCellAreaContext *context, + GtkWidget *widget, + cairo_t *cr, + const GdkRectangle *background_area, + const GdkRectangle *cell_area, + GtkCellRendererState flags, + gboolean paint_focus) { GtkCellAreaClass *class; @@ -1777,8 +1797,8 @@ gtk_cell_area_render (GtkCellArea *area, if (class->render) class->render (area, context, widget, cr, background_area, cell_area, flags, paint_focus); else - g_warning ("GtkCellAreaClass::render not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); + g_warning ("GtkCellAreaClass::render not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); } /** @@ -1793,7 +1813,7 @@ gtk_cell_area_render (GtkCellArea *area, */ void gtk_cell_area_set_style_detail (GtkCellArea *area, - const gchar *detail) + const gchar *detail) { GtkCellAreaPrivate *priv; @@ -1833,9 +1853,9 @@ gtk_cell_area_get_style_detail (GtkCellArea *area) static gboolean get_cell_allocation (GtkCellRenderer *renderer, - const GdkRectangle *cell_area, - const GdkRectangle *cell_background, - RendererAllocationData *data) + const GdkRectangle *cell_area, + const GdkRectangle *cell_background, + RendererAllocationData *data) { if (data->renderer == renderer) data->allocation = *cell_area; @@ -1860,11 +1880,11 @@ get_cell_allocation (GtkCellRenderer *renderer, */ void gtk_cell_area_get_cell_allocation (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - GtkCellRenderer *renderer, - const GdkRectangle *cell_area, - GdkRectangle *allocation) + GtkCellAreaContext *context, + GtkWidget *widget, + GtkCellRenderer *renderer, + const GdkRectangle *cell_area, + GdkRectangle *allocation) { RendererAllocationData data = { renderer, { 0, } }; @@ -1875,17 +1895,17 @@ gtk_cell_area_get_cell_allocation (GtkCellArea *area, g_return_if_fail (cell_area != NULL); g_return_if_fail (allocation != NULL); - gtk_cell_area_foreach_alloc (area, context, widget, cell_area, cell_area, - (GtkCellAllocCallback)get_cell_allocation, &data); + gtk_cell_area_foreach_alloc (area, context, widget, cell_area, cell_area, + (GtkCellAllocCallback)get_cell_allocation, &data); *allocation = data.allocation; } static gboolean get_cell_by_position (GtkCellRenderer *renderer, - const GdkRectangle *cell_area, - const GdkRectangle *cell_background, - CellByPositionData *data) + const GdkRectangle *cell_area, + const GdkRectangle *cell_background, + CellByPositionData *data) { if (data->x >= cell_area->x && data->x < cell_area->x + cell_area->width && data->y >= cell_area->y && data->y < cell_area->y + cell_area->height) @@ -1906,7 +1926,7 @@ get_cell_by_position (GtkCellRenderer *renderer, * for this row * @x: the x position * @y: the y position - * @alloc_area: (out) (allow-none): where to store the inner allocated area of the + * @alloc_area: (out) (allow-none): where to store the inner allocated area of the * returned cell renderer, or %NULL. * * Gets the #GtkCellRenderer at @x and @y coordinates inside @area and optionally @@ -1918,12 +1938,12 @@ get_cell_by_position (GtkCellRenderer *renderer, */ GtkCellRenderer * gtk_cell_area_get_cell_at_position (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - gint x, - gint y, - GdkRectangle *alloc_area) + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + gint x, + gint y, + GdkRectangle *alloc_area) { CellByPositionData data = { x, y, NULL, { 0, } }; @@ -1934,8 +1954,8 @@ gtk_cell_area_get_cell_at_position (GtkCellArea *area, g_return_val_if_fail (x >= cell_area->x && x <= cell_area->x + cell_area->width, NULL); g_return_val_if_fail (y >= cell_area->y && y <= cell_area->y + cell_area->height, NULL); - gtk_cell_area_foreach_alloc (area, context, widget, cell_area, cell_area, - (GtkCellAllocCallback)get_cell_by_position, &data); + gtk_cell_area_foreach_alloc (area, context, widget, cell_area, cell_area, + (GtkCellAllocCallback)get_cell_by_position, &data); if (alloc_area) *alloc_area = data.cell_area; @@ -1973,9 +1993,9 @@ gtk_cell_area_create_context (GtkCellArea *area) if (class->create_context) return class->create_context (area); - g_warning ("GtkCellAreaClass::create_context not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); - + g_warning ("GtkCellAreaClass::create_context not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); + return NULL; } @@ -2002,7 +2022,7 @@ gtk_cell_area_create_context (GtkCellArea *area) */ GtkCellAreaContext * gtk_cell_area_copy_context (GtkCellArea *area, - GtkCellAreaContext *context) + GtkCellAreaContext *context) { GtkCellAreaClass *class; @@ -2014,9 +2034,9 @@ gtk_cell_area_copy_context (GtkCellArea *area, if (class->copy_context) return class->copy_context (area, context); - g_warning ("GtkCellAreaClass::copy_context not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); - + g_warning ("GtkCellAreaClass::copy_context not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); + return NULL; } @@ -2031,22 +2051,22 @@ gtk_cell_area_copy_context (GtkCellArea *area, * * Since: 3.0 */ -GtkSizeRequestMode +GtkSizeRequestMode gtk_cell_area_get_request_mode (GtkCellArea *area) { GtkCellAreaClass *class; - g_return_val_if_fail (GTK_IS_CELL_AREA (area), - GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH); + g_return_val_if_fail (GTK_IS_CELL_AREA (area), + GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH); class = GTK_CELL_AREA_GET_CLASS (area); if (class->get_request_mode) return class->get_request_mode (area); - g_warning ("GtkCellAreaClass::get_request_mode not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); - + g_warning ("GtkCellAreaClass::get_request_mode not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); + return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH; } @@ -2070,10 +2090,10 @@ gtk_cell_area_get_request_mode (GtkCellArea *area) */ void gtk_cell_area_get_preferred_width (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint *minimum_width, - gint *natural_width) + GtkCellAreaContext *context, + GtkWidget *widget, + gint *minimum_width, + gint *natural_width) { GtkCellAreaClass *class; @@ -2085,8 +2105,8 @@ gtk_cell_area_get_preferred_width (GtkCellArea *area, if (class->get_preferred_width) class->get_preferred_width (area, context, widget, minimum_width, natural_width); else - g_warning ("GtkCellAreaClass::get_preferred_width not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); + g_warning ("GtkCellAreaClass::get_preferred_width not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); } /** @@ -2117,11 +2137,11 @@ gtk_cell_area_get_preferred_width (GtkCellArea *area, */ void gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint width, - gint *minimum_height, - gint *natural_height) + GtkCellAreaContext *context, + GtkWidget *widget, + gint width, + gint *minimum_height, + gint *natural_height) { GtkCellAreaClass *class; @@ -2153,10 +2173,10 @@ gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area, */ void gtk_cell_area_get_preferred_height (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint *minimum_height, - gint *natural_height) + GtkCellAreaContext *context, + GtkWidget *widget, + gint *minimum_height, + gint *natural_height) { GtkCellAreaClass *class; @@ -2168,8 +2188,8 @@ gtk_cell_area_get_preferred_height (GtkCellArea *area, if (class->get_preferred_height) class->get_preferred_height (area, context, widget, minimum_height, natural_height); else - g_warning ("GtkCellAreaClass::get_preferred_height not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); + g_warning ("GtkCellAreaClass::get_preferred_height not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); } /** @@ -2200,11 +2220,11 @@ gtk_cell_area_get_preferred_height (GtkCellArea *area, */ void gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint height, - gint *minimum_width, - gint *natural_width) + GtkCellAreaContext *context, + GtkWidget *widget, + gint height, + gint *minimum_width, + gint *natural_width) { GtkCellAreaClass *class; @@ -2233,10 +2253,10 @@ gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area, */ void gtk_cell_area_attribute_connect (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *attribute, - gint column) -{ + GtkCellRenderer *renderer, + const gchar *attribute, + gint column) +{ GtkCellAreaPrivate *priv; CellInfo *info; CellAttribute *cell_attribute; @@ -2261,17 +2281,17 @@ gtk_cell_area_attribute_connect (GtkCellArea *area, /* Check we are not adding the same attribute twice */ if ((node = g_slist_find_custom (info->attributes, attribute, - (GCompareFunc)cell_attribute_find)) != NULL) - { - cell_attribute = node->data; - - g_warning ("Cannot connect attribute `%s' for cell renderer class `%s' " - "since `%s' is already attributed to column %d", - attribute, - g_type_name (G_TYPE_FROM_INSTANCE (area)), - attribute, cell_attribute->column); - return; - } + (GCompareFunc)cell_attribute_find)) != NULL) + { + cell_attribute = node->data; + + g_warning ("Cannot connect attribute `%s' for cell renderer class `%s' " + "since `%s' is already attributed to column %d", + attribute, + g_type_name (G_TYPE_FROM_INSTANCE (area)), + attribute, cell_attribute->column); + return; + } } cell_attribute = cell_attribute_new (renderer, attribute, column); @@ -2279,9 +2299,9 @@ gtk_cell_area_attribute_connect (GtkCellArea *area, if (!cell_attribute) { g_warning ("Cannot connect attribute `%s' for cell renderer class `%s' " - "since attribute does not exist", - attribute, - g_type_name (G_TYPE_FROM_INSTANCE (area))); + "since attribute does not exist", + attribute, + g_type_name (G_TYPE_FROM_INSTANCE (area))); return; } @@ -2300,10 +2320,10 @@ gtk_cell_area_attribute_connect (GtkCellArea *area, * * Since: 3.0 */ -void +void gtk_cell_area_attribute_disconnect (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *attribute) + GtkCellRenderer *renderer, + const gchar *attribute) { GtkCellAreaPrivate *priv; CellInfo *info; @@ -2321,15 +2341,15 @@ gtk_cell_area_attribute_disconnect (GtkCellArea *area, if (info) { node = g_slist_find_custom (info->attributes, attribute, - (GCompareFunc)cell_attribute_find); + (GCompareFunc)cell_attribute_find); if (node) - { - cell_attribute = node->data; + { + cell_attribute = node->data; - cell_attribute_free (cell_attribute); + cell_attribute_free (cell_attribute); - info->attributes = g_slist_delete_link (info->attributes, node); - } + info->attributes = g_slist_delete_link (info->attributes, node); + } } } @@ -2342,24 +2362,24 @@ gtk_cell_area_attribute_disconnect (GtkCellArea *area, * @is_expanded: whether @iter is expanded in the view and * children are visible * - * Applies any connected attributes to the renderers in + * Applies any connected attributes to the renderers in * @area by pulling the values from @tree_model. * * Since: 3.0 */ void gtk_cell_area_apply_attributes (GtkCellArea *area, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gboolean is_expander, - gboolean is_expanded) + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gboolean is_expander, + gboolean is_expanded) { g_return_if_fail (GTK_IS_CELL_AREA (area)); g_return_if_fail (GTK_IS_TREE_MODEL (tree_model)); g_return_if_fail (iter != NULL); - g_signal_emit (area, cell_area_signals[SIGNAL_APPLY_ATTRIBUTES], 0, - tree_model, iter, is_expander, is_expanded); + g_signal_emit (area, cell_area_signals[SIGNAL_APPLY_ATTRIBUTES], 0, + tree_model, iter, is_expander, is_expanded); } /** @@ -2406,8 +2426,8 @@ gtk_cell_area_get_current_path_string (GtkCellArea *area) */ void gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass, - guint property_id, - GParamSpec *pspec) + guint property_id, + GParamSpec *pspec) { g_return_if_fail (GTK_IS_CELL_AREA_CLASS (aclass)); g_return_if_fail (G_IS_PARAM_SPEC (pspec)); @@ -2422,7 +2442,7 @@ gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass, if (g_param_spec_pool_lookup (cell_property_pool, pspec->name, G_OBJECT_CLASS_TYPE (aclass), TRUE)) { g_warning (G_STRLOC ": class `%s' already contains a cell property named `%s'", - G_OBJECT_CLASS_NAME (aclass), pspec->name); + G_OBJECT_CLASS_NAME (aclass), pspec->name); return; } g_param_spec_ref (pspec); @@ -2445,15 +2465,15 @@ gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass, */ GParamSpec* gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass, - const gchar *property_name) + const gchar *property_name) { g_return_val_if_fail (GTK_IS_CELL_AREA_CLASS (aclass), NULL); g_return_val_if_fail (property_name != NULL, NULL); return g_param_spec_pool_lookup (cell_property_pool, - property_name, - G_OBJECT_CLASS_TYPE (aclass), - TRUE); + property_name, + G_OBJECT_CLASS_TYPE (aclass), + TRUE); } /** @@ -2470,7 +2490,7 @@ gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass, */ GParamSpec** gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass, - guint *n_properties) + guint *n_properties) { GParamSpec **pspecs; guint n; @@ -2478,8 +2498,8 @@ gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass, g_return_val_if_fail (GTK_IS_CELL_AREA_CLASS (aclass), NULL); pspecs = g_param_spec_pool_list (cell_property_pool, - G_OBJECT_CLASS_TYPE (aclass), - &n); + G_OBJECT_CLASS_TYPE (aclass), + &n); if (n_properties) *n_properties = n; @@ -2501,9 +2521,9 @@ gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass, */ void gtk_cell_area_add_with_properties (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *first_prop_name, - ...) + GtkCellRenderer *renderer, + const gchar *first_prop_name, + ...) { GtkCellAreaClass *class; @@ -2523,8 +2543,8 @@ gtk_cell_area_add_with_properties (GtkCellArea *area, va_end (var_args); } else - g_warning ("GtkCellAreaClass::add not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); + g_warning ("GtkCellAreaClass::add not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); } /** @@ -2541,9 +2561,9 @@ gtk_cell_area_add_with_properties (GtkCellArea *area, */ void gtk_cell_area_cell_set (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *first_prop_name, - ...) + GtkCellRenderer *renderer, + const gchar *first_prop_name, + ...) { va_list var_args; @@ -2569,9 +2589,9 @@ gtk_cell_area_cell_set (GtkCellArea *area, */ void gtk_cell_area_cell_get (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *first_prop_name, - ...) + GtkCellRenderer *renderer, + const gchar *first_prop_name, + ...) { va_list var_args; @@ -2585,20 +2605,20 @@ gtk_cell_area_cell_get (GtkCellArea *area, static inline void area_get_cell_property (GtkCellArea *area, - GtkCellRenderer *renderer, - GParamSpec *pspec, - GValue *value) + GtkCellRenderer *renderer, + GParamSpec *pspec, + GValue *value) { GtkCellAreaClass *class = g_type_class_peek (pspec->owner_type); - + class->get_cell_property (area, renderer, PARAM_SPEC_PARAM_ID (pspec), value, pspec); } static inline void area_set_cell_property (GtkCellArea *area, - GtkCellRenderer *renderer, - GParamSpec *pspec, - const GValue *value) + GtkCellRenderer *renderer, + GParamSpec *pspec, + const GValue *value) { GValue tmp_value = { 0, }; GtkCellAreaClass *class = g_type_class_peek (pspec->owner_type); @@ -2607,18 +2627,18 @@ area_set_cell_property (GtkCellArea *area, g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec)); if (!g_value_transform (value, &tmp_value)) g_warning ("unable to set cell property `%s' of type `%s' from value of type `%s'", - pspec->name, - g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)), - G_VALUE_TYPE_NAME (value)); + pspec->name, + g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)), + G_VALUE_TYPE_NAME (value)); else if (g_param_value_validate (pspec, &tmp_value) && !(pspec->flags & G_PARAM_LAX_VALIDATION)) { gchar *contents = g_strdup_value_contents (value); g_warning ("value \"%s\" of type `%s' is invalid for property `%s' of type `%s'", - contents, - G_VALUE_TYPE_NAME (value), - pspec->name, - g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec))); + contents, + G_VALUE_TYPE_NAME (value), + pspec->name, + g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec))); g_free (contents); } else @@ -2642,9 +2662,9 @@ area_set_cell_property (GtkCellArea *area, */ void gtk_cell_area_cell_set_valist (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *first_property_name, - va_list var_args) + GtkCellRenderer *renderer, + const gchar *first_property_name, + va_list var_args) { const gchar *name; @@ -2656,34 +2676,34 @@ gtk_cell_area_cell_set_valist (GtkCellArea *area, { GValue value = { 0, }; gchar *error = NULL; - GParamSpec *pspec = - g_param_spec_pool_lookup (cell_property_pool, name, - G_OBJECT_TYPE (area), TRUE); + GParamSpec *pspec = + g_param_spec_pool_lookup (cell_property_pool, name, + G_OBJECT_TYPE (area), TRUE); if (!pspec) - { - g_warning ("%s: cell area class `%s' has no cell property named `%s'", - G_STRLOC, G_OBJECT_TYPE_NAME (area), name); - break; - } + { + g_warning ("%s: cell area class `%s' has no cell property named `%s'", + G_STRLOC, G_OBJECT_TYPE_NAME (area), name); + break; + } if (!(pspec->flags & G_PARAM_WRITABLE)) - { - g_warning ("%s: cell property `%s' of cell area class `%s' is not writable", - G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (area)); - break; - } + { + g_warning ("%s: cell property `%s' of cell area class `%s' is not writable", + G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (area)); + break; + } g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); G_VALUE_COLLECT (&value, var_args, 0, &error); if (error) - { - g_warning ("%s: %s", G_STRLOC, error); - g_free (error); - - /* we purposely leak the value here, it might not be - * in a sane state if an error condition occoured - */ - break; - } + { + g_warning ("%s: %s", G_STRLOC, error); + g_free (error); + + /* we purposely leak the value here, it might not be + * in a sane state if an error condition occoured + */ + break; + } area_set_cell_property (area, renderer, pspec, &value); g_value_unset (&value); name = va_arg (var_args, gchar*); @@ -2704,9 +2724,9 @@ gtk_cell_area_cell_set_valist (GtkCellArea *area, */ void gtk_cell_area_cell_get_valist (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *first_property_name, - va_list var_args) + GtkCellRenderer *renderer, + const gchar *first_property_name, + va_list var_args) { const gchar *name; @@ -2721,30 +2741,30 @@ gtk_cell_area_cell_get_valist (GtkCellArea *area, gchar *error; pspec = g_param_spec_pool_lookup (cell_property_pool, name, - G_OBJECT_TYPE (area), TRUE); + G_OBJECT_TYPE (area), TRUE); if (!pspec) - { - g_warning ("%s: cell area class `%s' has no cell property named `%s'", - G_STRLOC, G_OBJECT_TYPE_NAME (area), name); - break; - } + { + g_warning ("%s: cell area class `%s' has no cell property named `%s'", + G_STRLOC, G_OBJECT_TYPE_NAME (area), name); + break; + } if (!(pspec->flags & G_PARAM_READABLE)) - { - g_warning ("%s: cell property `%s' of cell area class `%s' is not readable", - G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (area)); - break; - } + { + g_warning ("%s: cell property `%s' of cell area class `%s' is not readable", + G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (area)); + break; + } g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); area_get_cell_property (area, renderer, pspec, &value); G_VALUE_LCOPY (&value, var_args, 0, &error); if (error) - { - g_warning ("%s: %s", G_STRLOC, error); - g_free (error); - g_value_unset (&value); - break; - } + { + g_warning ("%s: %s", G_STRLOC, error); + g_free (error); + g_value_unset (&value); + break; + } g_value_unset (&value); name = va_arg (var_args, gchar*); } @@ -2763,9 +2783,9 @@ gtk_cell_area_cell_get_valist (GtkCellArea *area, */ void gtk_cell_area_cell_set_property (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *property_name, - const GValue *value) + GtkCellRenderer *renderer, + const gchar *property_name, + const GValue *value) { GParamSpec *pspec; @@ -2773,15 +2793,15 @@ gtk_cell_area_cell_set_property (GtkCellArea *area, g_return_if_fail (GTK_IS_CELL_RENDERER (renderer)); g_return_if_fail (property_name != NULL); g_return_if_fail (G_IS_VALUE (value)); - + pspec = g_param_spec_pool_lookup (cell_property_pool, property_name, - G_OBJECT_TYPE (area), TRUE); + G_OBJECT_TYPE (area), TRUE); if (!pspec) g_warning ("%s: cell area class `%s' has no cell property named `%s'", - G_STRLOC, G_OBJECT_TYPE_NAME (area), property_name); + G_STRLOC, G_OBJECT_TYPE_NAME (area), property_name); else if (!(pspec->flags & G_PARAM_WRITABLE)) g_warning ("%s: cell property `%s' of cell area class `%s' is not writable", - G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (area)); + G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (area)); else { area_set_cell_property (area, renderer, pspec, value); @@ -2801,9 +2821,9 @@ gtk_cell_area_cell_set_property (GtkCellArea *area, */ void gtk_cell_area_cell_get_property (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *property_name, - GValue *value) + GtkCellRenderer *renderer, + const gchar *property_name, + GValue *value) { GParamSpec *pspec; @@ -2811,15 +2831,15 @@ gtk_cell_area_cell_get_property (GtkCellArea *area, g_return_if_fail (GTK_IS_CELL_RENDERER (renderer)); g_return_if_fail (property_name != NULL); g_return_if_fail (G_IS_VALUE (value)); - + pspec = g_param_spec_pool_lookup (cell_property_pool, property_name, - G_OBJECT_TYPE (area), TRUE); + G_OBJECT_TYPE (area), TRUE); if (!pspec) g_warning ("%s: cell area class `%s' has no cell property named `%s'", - G_STRLOC, G_OBJECT_TYPE_NAME (area), property_name); + G_STRLOC, G_OBJECT_TYPE_NAME (area), property_name); else if (!(pspec->flags & G_PARAM_READABLE)) g_warning ("%s: cell property `%s' of cell area class `%s' is not readable", - G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (area)); + G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (area)); else { GValue *prop_value, tmp_value = { 0, }; @@ -2827,31 +2847,31 @@ gtk_cell_area_cell_get_property (GtkCellArea *area, /* auto-conversion of the callers value type */ if (G_VALUE_TYPE (value) == G_PARAM_SPEC_VALUE_TYPE (pspec)) - { - g_value_reset (value); - prop_value = value; - } + { + g_value_reset (value); + prop_value = value; + } else if (!g_value_type_transformable (G_PARAM_SPEC_VALUE_TYPE (pspec), G_VALUE_TYPE (value))) - { - g_warning ("can't retrieve cell property `%s' of type `%s' as value of type `%s'", - pspec->name, - g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)), - G_VALUE_TYPE_NAME (value)); - return; - } + { + g_warning ("can't retrieve cell property `%s' of type `%s' as value of type `%s'", + pspec->name, + g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)), + G_VALUE_TYPE_NAME (value)); + return; + } else - { - g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec)); - prop_value = &tmp_value; - } + { + g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec)); + prop_value = &tmp_value; + } area_get_cell_property (area, renderer, pspec, prop_value); if (prop_value != value) - { - g_value_transform (prop_value, value); - g_value_unset (&tmp_value); - } + { + g_value_transform (prop_value, value); + g_value_unset (&tmp_value); + } } } @@ -2897,7 +2917,7 @@ gtk_cell_area_is_activatable (GtkCellArea *area) */ gboolean gtk_cell_area_focus (GtkCellArea *area, - GtkDirectionType direction) + GtkDirectionType direction) { GtkCellAreaClass *class; @@ -2908,8 +2928,8 @@ gtk_cell_area_focus (GtkCellArea *area, if (class->focus) return class->focus (area, direction); - g_warning ("GtkCellAreaClass::focus not implemented for `%s'", - g_type_name (G_TYPE_FROM_INSTANCE (area))); + g_warning ("GtkCellAreaClass::focus not implemented for `%s'", + g_type_name (G_TYPE_FROM_INSTANCE (area))); return FALSE; } @@ -2934,11 +2954,11 @@ gtk_cell_area_focus (GtkCellArea *area, */ gboolean gtk_cell_area_activate (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - GtkCellRendererState flags, - gboolean edit_only) + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + GtkCellRendererState flags, + gboolean edit_only) { g_return_val_if_fail (GTK_IS_CELL_AREA (area), FALSE); @@ -2961,7 +2981,7 @@ gtk_cell_area_activate (GtkCellArea *area, */ void gtk_cell_area_set_focus_cell (GtkCellArea *area, - GtkCellRenderer *renderer) + GtkCellRenderer *renderer) { GtkCellAreaPrivate *priv; @@ -2973,12 +2993,12 @@ gtk_cell_area_set_focus_cell (GtkCellArea *area, if (priv->focus_cell != renderer) { if (priv->focus_cell) - g_object_unref (priv->focus_cell); + g_object_unref (priv->focus_cell); priv->focus_cell = renderer; if (priv->focus_cell) - g_object_ref (priv->focus_cell); + g_object_ref (priv->focus_cell); g_object_notify (G_OBJECT (area), "focus-cell"); } @@ -2986,8 +3006,8 @@ gtk_cell_area_set_focus_cell (GtkCellArea *area, /* Signal that the current focus renderer for this path changed * (it may be that the focus cell did not change, but the row * may have changed so we need to signal it) */ - g_signal_emit (area, cell_area_signals[SIGNAL_FOCUS_CHANGED], 0, - priv->focus_cell, priv->current_path); + g_signal_emit (area, cell_area_signals[SIGNAL_FOCUS_CHANGED], 0, + priv->focus_cell, priv->current_path); } @@ -3025,7 +3045,7 @@ gtk_cell_area_get_focus_cell (GtkCellArea *area) * @sibling: the #GtkCellRenderer to add to @renderer's focus area * * Adds @sibling to @renderer's focusable area, focus will be drawn - * around @renderer and all of it's siblings if @renderer can + * around @renderer and all of it's siblings if @renderer can * focus for a given row. * * Events handled by focus siblings can also activate the given @@ -3035,8 +3055,8 @@ gtk_cell_area_get_focus_cell (GtkCellArea *area) */ void gtk_cell_area_add_focus_sibling (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkCellRenderer *sibling) + GtkCellRenderer *renderer, + GtkCellRenderer *sibling) { GtkCellAreaPrivate *priv; GList *siblings; @@ -3072,16 +3092,16 @@ gtk_cell_area_add_focus_sibling (GtkCellArea *area, * @area: a #GtkCellArea * @renderer: the #GtkCellRenderer expected to have focus * @sibling: the #GtkCellRenderer to remove from @renderer's focus area - * - * Removes @sibling from @renderer's focus sibling list + * + * Removes @sibling from @renderer's focus sibling list * (see gtk_cell_area_add_focus_sibling()). * * Since: 3.0 */ void gtk_cell_area_remove_focus_sibling (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkCellRenderer *sibling) + GtkCellRenderer *renderer, + GtkCellRenderer *sibling) { GtkCellAreaPrivate *priv; GList *siblings; @@ -3109,7 +3129,7 @@ gtk_cell_area_remove_focus_sibling (GtkCellArea *area, * @area: a #GtkCellArea * @renderer: the #GtkCellRenderer expected to have focus * @sibling: the #GtkCellRenderer to check against @renderer's sibling list - * + * * Returns %TRUE if @sibling is one of @renderer's focus siblings * (see gtk_cell_area_add_focus_sibling()). * @@ -3117,8 +3137,8 @@ gtk_cell_area_remove_focus_sibling (GtkCellArea *area, */ gboolean gtk_cell_area_is_focus_sibling (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkCellRenderer *sibling) + GtkCellRenderer *renderer, + GtkCellRenderer *sibling) { GtkCellAreaPrivate *priv; GList *siblings, *l; @@ -3136,7 +3156,7 @@ gtk_cell_area_is_focus_sibling (GtkCellArea *area, GtkCellRenderer *a_sibling = l->data; if (a_sibling == sibling) - return TRUE; + return TRUE; } return FALSE; @@ -3149,14 +3169,14 @@ gtk_cell_area_is_focus_sibling (GtkCellArea *area, * * Gets the focus sibling cell renderers for @renderer. * - * Return value: (element-type GtkCellRenderer) (transfer none): A #GList of #GtkCellRenderers. + * Return value: (element-type GtkCellRenderer) (transfer none): A #GList of #GtkCellRenderers. * The returned list is internal and should not be freed. * * Since: 3.0 */ const GList * gtk_cell_area_get_focus_siblings (GtkCellArea *area, - GtkCellRenderer *renderer) + GtkCellRenderer *renderer) { GtkCellAreaPrivate *priv; @@ -3165,7 +3185,7 @@ gtk_cell_area_get_focus_siblings (GtkCellArea *area, priv = area->priv; - return g_hash_table_lookup (priv->focus_siblings, renderer); + return g_hash_table_lookup (priv->focus_siblings, renderer); } /** @@ -3187,7 +3207,7 @@ gtk_cell_area_get_focus_siblings (GtkCellArea *area, */ GtkCellRenderer * gtk_cell_area_get_focus_from_sibling (GtkCellArea *area, - GtkCellRenderer *renderer) + GtkCellRenderer *renderer) { GtkCellRenderer *ret_renderer = NULL; GList *renderers, *l; @@ -3202,17 +3222,17 @@ gtk_cell_area_get_focus_from_sibling (GtkCellArea *area, GtkCellRenderer *a_renderer = l->data; const GList *list; - for (list = gtk_cell_area_get_focus_siblings (area, a_renderer); - list; list = list->next) - { - GtkCellRenderer *sibling_renderer = list->data; - - if (sibling_renderer == renderer) - { - ret_renderer = a_renderer; - break; - } - } + for (list = gtk_cell_area_get_focus_siblings (area, a_renderer); + list; list = list->next) + { + GtkCellRenderer *sibling_renderer = list->data; + + if (sibling_renderer == renderer) + { + ret_renderer = a_renderer; + break; + } + } } g_list_free (renderers); @@ -3224,25 +3244,25 @@ gtk_cell_area_get_focus_from_sibling (GtkCellArea *area, *************************************************************/ static void gtk_cell_area_add_editable (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkCellEditable *editable, - const GdkRectangle *cell_area) + GtkCellRenderer *renderer, + GtkCellEditable *editable, + const GdkRectangle *cell_area) { - g_signal_emit (area, cell_area_signals[SIGNAL_ADD_EDITABLE], 0, - renderer, editable, cell_area, area->priv->current_path); + g_signal_emit (area, cell_area_signals[SIGNAL_ADD_EDITABLE], 0, + renderer, editable, cell_area, area->priv->current_path); } static void gtk_cell_area_remove_editable (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkCellEditable *editable) + GtkCellRenderer *renderer, + GtkCellEditable *editable) { g_signal_emit (area, cell_area_signals[SIGNAL_REMOVE_EDITABLE], 0, renderer, editable); } static void cell_area_remove_widget_cb (GtkCellEditable *editable, - GtkCellArea *area) + GtkCellArea *area) { GtkCellAreaPrivate *priv = area->priv; @@ -3259,7 +3279,7 @@ cell_area_remove_widget_cb (GtkCellEditable *editable, static void gtk_cell_area_set_edited_cell (GtkCellArea *area, - GtkCellRenderer *renderer) + GtkCellRenderer *renderer) { GtkCellAreaPrivate *priv; @@ -3271,12 +3291,12 @@ gtk_cell_area_set_edited_cell (GtkCellArea *area, if (priv->edited_cell != renderer) { if (priv->edited_cell) - g_object_unref (priv->edited_cell); + g_object_unref (priv->edited_cell); priv->edited_cell = renderer; if (priv->edited_cell) - g_object_ref (priv->edited_cell); + g_object_ref (priv->edited_cell); g_object_notify (G_OBJECT (area), "edited-cell"); } @@ -3284,7 +3304,7 @@ gtk_cell_area_set_edited_cell (GtkCellArea *area, static void gtk_cell_area_set_edit_widget (GtkCellArea *area, - GtkCellEditable *editable) + GtkCellEditable *editable) { GtkCellAreaPrivate *priv; @@ -3296,22 +3316,22 @@ gtk_cell_area_set_edit_widget (GtkCellArea *area, if (priv->edit_widget != editable) { if (priv->edit_widget) - { - g_signal_handler_disconnect (priv->edit_widget, priv->remove_widget_id); + { + g_signal_handler_disconnect (priv->edit_widget, priv->remove_widget_id); - g_object_unref (priv->edit_widget); - } + g_object_unref (priv->edit_widget); + } priv->edit_widget = editable; if (priv->edit_widget) - { - priv->remove_widget_id = - g_signal_connect (priv->edit_widget, "remove-widget", - G_CALLBACK (cell_area_remove_widget_cb), area); + { + priv->remove_widget_id = + g_signal_connect (priv->edit_widget, "remove-widget", + G_CALLBACK (cell_area_remove_widget_cb), area); - g_object_ref (priv->edit_widget); - } + g_object_ref (priv->edit_widget); + } g_object_notify (G_OBJECT (area), "edit-widget"); } @@ -3384,15 +3404,15 @@ gtk_cell_area_get_edit_widget (GtkCellArea *area) */ gboolean gtk_cell_area_activate_cell (GtkCellArea *area, - GtkWidget *widget, - GtkCellRenderer *renderer, - GdkEvent *event, - const GdkRectangle *cell_area, - GtkCellRendererState flags) + GtkWidget *widget, + GtkCellRenderer *renderer, + GdkEvent *event, + const GdkRectangle *cell_area, + GtkCellRendererState flags) { GtkCellRendererMode mode; GtkCellAreaPrivate *priv; - + g_return_val_if_fail (GTK_IS_CELL_AREA (area), FALSE); g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), FALSE); @@ -3405,12 +3425,12 @@ gtk_cell_area_activate_cell (GtkCellArea *area, if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE) { if (gtk_cell_renderer_activate (renderer, - event, widget, - priv->current_path, - cell_area, - cell_area, - flags)) - return TRUE; + event, widget, + priv->current_path, + cell_area, + cell_area, + flags)) + return TRUE; } else if (mode == GTK_CELL_RENDERER_MODE_EDITABLE) { @@ -3418,43 +3438,43 @@ gtk_cell_area_activate_cell (GtkCellArea *area, GdkRectangle inner_area; gtk_cell_area_inner_cell_area (area, widget, cell_area, &inner_area); - + editable_widget = - gtk_cell_renderer_start_editing (renderer, - event, widget, - priv->current_path, - &inner_area, - &inner_area, - flags); - + gtk_cell_renderer_start_editing (renderer, + event, widget, + priv->current_path, + &inner_area, + &inner_area, + flags); + if (editable_widget != NULL) - { - g_return_val_if_fail (GTK_IS_CELL_EDITABLE (editable_widget), FALSE); - - gtk_cell_area_set_edited_cell (area, renderer); - gtk_cell_area_set_edit_widget (area, editable_widget); - - /* Signal that editing started so that callers can get - * a handle on the editable_widget */ - gtk_cell_area_add_editable (area, priv->focus_cell, editable_widget, cell_area); - - /* If the signal was successfully handled start the editing */ - if (gtk_widget_get_parent (GTK_WIDGET (editable_widget))) - { - gtk_cell_editable_start_editing (editable_widget, NULL); - gtk_widget_grab_focus (GTK_WIDGET (editable_widget)); - } - else - { - /* Otherwise clear the editing state and fire a warning */ - gtk_cell_area_set_edited_cell (area, NULL); - gtk_cell_area_set_edit_widget (area, NULL); - - g_warning ("GtkCellArea::add-editable fired in the dark, no cell editing was started."); - } - - return TRUE; - } + { + g_return_val_if_fail (GTK_IS_CELL_EDITABLE (editable_widget), FALSE); + + gtk_cell_area_set_edited_cell (area, renderer); + gtk_cell_area_set_edit_widget (area, editable_widget); + + /* Signal that editing started so that callers can get + * a handle on the editable_widget */ + gtk_cell_area_add_editable (area, priv->focus_cell, editable_widget, cell_area); + + /* If the signal was successfully handled start the editing */ + if (gtk_widget_get_parent (GTK_WIDGET (editable_widget))) + { + gtk_cell_editable_start_editing (editable_widget, NULL); + gtk_widget_grab_focus (GTK_WIDGET (editable_widget)); + } + else + { + /* Otherwise clear the editing state and fire a warning */ + gtk_cell_area_set_edited_cell (area, NULL); + gtk_cell_area_set_edit_widget (area, NULL); + + g_warning ("GtkCellArea::add-editable fired in the dark, no cell editing was started."); + } + + return TRUE; + } } return FALSE; @@ -3475,7 +3495,7 @@ gtk_cell_area_activate_cell (GtkCellArea *area, */ void gtk_cell_area_stop_editing (GtkCellArea *area, - gboolean canceled) + gboolean canceled) { GtkCellAreaPrivate *priv; @@ -3490,7 +3510,7 @@ gtk_cell_area_stop_editing (GtkCellArea *area, /* Stop editing of the cell renderer */ gtk_cell_renderer_stop_editing (priv->edited_cell, canceled); - + /* Remove any references to the editable widget */ gtk_cell_area_set_edited_cell (area, NULL); gtk_cell_area_set_edit_widget (area, NULL); @@ -3512,7 +3532,7 @@ gtk_cell_area_stop_editing (GtkCellArea *area, * gtk_cell_area_inner_cell_area: * @area: a #GtkCellArea * @widget: the #GtkWidget that @area is rendering onto - * @cell_area: the @widget relative coordinates where one of @area's cells + * @cell_area: the @widget relative coordinates where one of @area's cells * is to be placed * @inner_area: (out): the return location for the inner cell area * @@ -3524,9 +3544,9 @@ gtk_cell_area_stop_editing (GtkCellArea *area, */ void gtk_cell_area_inner_cell_area (GtkCellArea *area, - GtkWidget *widget, - const GdkRectangle *cell_area, - GdkRectangle *inner_area) + GtkWidget *widget, + const GdkRectangle *cell_area, + GdkRectangle *inner_area) { gint focus_line_width; @@ -3566,12 +3586,12 @@ gtk_cell_area_inner_cell_area (GtkCellArea *area, */ void gtk_cell_area_request_renderer (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkOrientation orientation, - GtkWidget *widget, - gint for_size, - gint *minimum_size, - gint *natural_size) + GtkCellRenderer *renderer, + GtkOrientation orientation, + GtkWidget *widget, + gint for_size, + gint *minimum_size, + gint *natural_size) { GtkCellAreaPrivate *priv; gint focus_line_width; @@ -3591,26 +3611,26 @@ gtk_cell_area_request_renderer (GtkCellArea *area, if (orientation == GTK_ORIENTATION_HORIZONTAL) { if (for_size < 0) - gtk_cell_renderer_get_preferred_width (renderer, widget, minimum_size, natural_size); + gtk_cell_renderer_get_preferred_width (renderer, widget, minimum_size, natural_size); else - { - for_size = MAX (0, for_size - focus_line_width); + { + for_size = MAX (0, for_size - focus_line_width); - gtk_cell_renderer_get_preferred_width_for_height (renderer, widget, for_size, - minimum_size, natural_size); - } + gtk_cell_renderer_get_preferred_width_for_height (renderer, widget, for_size, + minimum_size, natural_size); + } } else /* GTK_ORIENTATION_VERTICAL */ { if (for_size < 0) - gtk_cell_renderer_get_preferred_height (renderer, widget, minimum_size, natural_size); + gtk_cell_renderer_get_preferred_height (renderer, widget, minimum_size, natural_size); else - { - for_size = MAX (0, for_size - focus_line_width); + { + for_size = MAX (0, for_size - focus_line_width); - gtk_cell_renderer_get_preferred_height_for_width (renderer, widget, for_size, - minimum_size, natural_size); - } + gtk_cell_renderer_get_preferred_height_for_width (renderer, widget, for_size, + minimum_size, natural_size); + } } *minimum_size += focus_line_width; diff --git a/gtk/gtkcellarea.h b/gtk/gtkcellarea.h index f9c1c45b90..d8d06cfecc 100644 --- a/gtk/gtkcellarea.h +++ b/gtk/gtkcellarea.h @@ -34,10 +34,10 @@ G_BEGIN_DECLS -#define GTK_TYPE_CELL_AREA (gtk_cell_area_get_type ()) -#define GTK_CELL_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA, GtkCellArea)) -#define GTK_CELL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA, GtkCellAreaClass)) -#define GTK_IS_CELL_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA)) +#define GTK_TYPE_CELL_AREA (gtk_cell_area_get_type ()) +#define GTK_CELL_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA, GtkCellArea)) +#define GTK_CELL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA, GtkCellAreaClass)) +#define GTK_IS_CELL_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA)) #define GTK_IS_CELL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA)) #define GTK_CELL_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA, GtkCellAreaClass)) @@ -49,7 +49,7 @@ typedef struct _GtkCellAreaContext GtkCellAreaContext; /** * GTK_CELL_AREA_WARN_INVALID_CELL_PROPERTY_ID: * @object: the #GObject on which set_cell_property() or get_get_property() - * was called + * was called * @property_id: the numeric id of the property * @pspec: the #GParamSpec of the property * @@ -70,26 +70,27 @@ typedef struct _GtkCellAreaContext GtkCellAreaContext; * Return value: %TRUE to stop iterating over cells. */ typedef gboolean (*GtkCellCallback) (GtkCellRenderer *renderer, - gpointer data); + gpointer data); /** * GtkCellAllocCallback: * @renderer: the cell renderer to operate on - * @cell_area: the area allocated to @renderer inside the rectangle provided to gtk_cell_area_foreach_alloc(). - * @cell_background: the background area for @renderer inside the background - * area provided to gtk_cell_area_foreach_alloc(). + * @cell_area: the area allocated to @renderer inside the rectangle + * provided to gtk_cell_area_foreach_alloc(). + * @cell_background: the background area for @renderer inside the + * background area provided to gtk_cell_area_foreach_alloc(). * @data: user-supplied data * - * The type of the callback functions used for iterating over - * the cell renderers and their allocated areas inside a #GtkCellArea, + * The type of the callback functions used for iterating over the + * cell renderers and their allocated areas inside a #GtkCellArea, * see gtk_cell_area_foreach_alloc(). * * Return value: %TRUE to stop iterating over cells. */ typedef gboolean (*GtkCellAllocCallback) (GtkCellRenderer *renderer, - const GdkRectangle *cell_area, - const GdkRectangle *cell_background, - gpointer data); + const GdkRectangle *cell_area, + const GdkRectangle *cell_background, + gpointer data); struct _GtkCellArea @@ -105,60 +106,71 @@ struct _GtkCellArea * GtkCellAreaClass: * @add: adds a #GtkCellRenderer to the area. * @remove: removes a #GtkCellRenderer from the area. - * @foreach: Calls the #GtkCellCallback function on every #GtkCellRenderer in the area - * with the provided user data until the callback returns %TRUE. - * @foreach_alloc: Calls the #GtkCellAllocCallback function on every #GtkCellRenderer in the area - * with the allocated area for the cell and the provided user data until the callback returns %TRUE. - * @event: Handle an event in the area, this is generally used to activate a cell - * at the event location for button events but can also be used to generically pass - * events to #GtkWidgets drawn onto the area. - * @render: Actually render the area's cells to the specified rectangle, @background_area - * should be correctly distributed to the cells coresponding background areas. - * @apply_attributes: Apply the cell attributes to the cells. This is implemented as a signal and - * generally #GtkCellArea subclasses dont need to implement this since it's handled by the base - * class but can be overridden to apply some custom attributes. - * @create_context: Creates and returns a class specific #GtkCellAreaContext to store cell - * alignment and allocation details for a said #GtkCellArea class. - * @copy_context: Creates a new #GtkCellAreaContext in the same state as the passed @context - * with any cell alignment data and allocations in tact. - * @get_request_mode: This allows an area to tell its layouting widget whether it prefers to - * be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode. - * @get_preferred_width: Calculates the minimum and natural width of the area's cells - * with the current attributes applied while considering the particular layouting details - * of the said #GtkCellArea. While requests are performed over a series of rows, alignments - * and overall minimum and natural sizes should be stored in the corresponding #GtkCellAreaContext. - * @get_preferred_height_for_width: Calculates the minimum and natural height for the area - * if the passed @context would be allocated the given width. When implementing this virtual - * method it is safe to assume that @context has already stored the aligned cell widths - * for every #GtkTreeModel row that @context will be allocated for since this information - * was stored at #GtkCellAreaClass.get_preferred_width() time. This virtual method should - * also store any necessary alignments of cell heights for the case that the context is - * allocated a height. - * @get_preferred_height: Calculates the minimum and natural height of the area's cells - * with the current attributes applied. Essentially this is the same as - * #GtkCellAreaClass.get_preferred_width() only for areas that are being requested as - * %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT. - * @get_preferred_width_for_height: Calculates the minimum and natural width for the area - * if the passed @context would be allocated the given height. The same as - * #GtkCellAreaClass.get_preferred_height_for_width() only for handling requests in the - * %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode. - * @set_cell_property: This should be implemented to handle changes in child cell properties - * for a given #GtkCellRenderer that were previously installed on the #GtkCellAreaClass with - * gtk_cell_area_class_install_cell_property(). - * @get_cell_property: This should be implemented to report the values of child cell properties - * for a given child #GtkCellRenderer. - * @focus: This virtual method should be implemented to navigate focus from cell to cell - * inside the #GtkCellArea. The #GtkCellArea should move focus from cell to cell inside - * the area and return %FALSE if focus logically leaves the area with the following exceptions: - * When the area contains no activatable cells, the entire area recieves focus. Focus should not - * be given to cells that are actually "focus siblings" of other sibling cells - * (see gtk_cell_area_get_focus_from_sibling()). Focus is set by calling gtk_cell_area_set_focus_cell(). - * @is_activatable: Returns whether the #GtkCellArea can respond to #GtkCellAreaClass.activate(), - * usually this does not need to be implemented since the base class takes care of this however - * it can be enhanced if the #GtkCellArea subclass can handle activation in other ways than - * activating its #GtkCellRenderers. - * @activate: This is called when the layouting widget rendering the #GtkCellArea activates - * the focus cell (see gtk_cell_area_get_focus_cell()). + * @foreach: calls the #GtkCellCallback function on every #GtkCellRenderer in + * the area with the provided user data until the callback returns %TRUE. + * @foreach_alloc: Calls the #GtkCellAllocCallback function on every + * #GtkCellRenderer in the area with the allocated area for the cell + * and the provided user data until the callback returns %TRUE. + * @event: Handle an event in the area, this is generally used to activate + * a cell at the event location for button events but can also be used + * to generically pass events to #GtkWidgets drawn onto the area. + * @render: Actually render the area's cells to the specified rectangle, + * @background_area should be correctly distributed to the cells + * corresponding background areas. + * @apply_attributes: Apply the cell attributes to the cells. This is + * implemented as a signal and generally #GtkCellArea subclasses don't + * need to implement it since it is handled by the base class. + * @create_context: Creates and returns a class specific #GtkCellAreaContext + * to store cell alignment and allocation details for a said #GtkCellArea + * class. + * @copy_context: Creates a new #GtkCellAreaContext in the same state as + * the passed @context with any cell alignment data and allocations intact. + * @get_request_mode: This allows an area to tell its layouting widget whether + * it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or + * %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode. + * @get_preferred_width: Calculates the minimum and natural width of the + * areas cells with the current attributes applied while considering + * the particular layouting details of the said #GtkCellArea. While + * requests are performed over a series of rows, alignments and overall + * minimum and natural sizes should be stored in the corresponding + * #GtkCellAreaContext. + * @get_preferred_height_for_width: Calculates the minimum and natural height + * for the area if the passed @context would be allocated the given width. + * When implementing this virtual method it is safe to assume that @context + * has already stored the aligned cell widths for every #GtkTreeModel row + * that @context will be allocated for since this information was stored + * at #GtkCellAreaClass.get_preferred_width() time. This virtual method + * should also store any necessary alignments of cell heights for the + * case that the context is allocated a height. + * @get_preferred_height: Calculates the minimum and natural height of the + * areas cells with the current attributes applied. Essentially this is + * the same as #GtkCellAreaClass.get_preferred_width() only for areas + * that are being requested as %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT. + * @get_preferred_width_for_height: Calculates the minimum and natural width + * for the area if the passed @context would be allocated the given + * height. The same as #GtkCellAreaClass.get_preferred_height_for_width() + * only for handling requests in the %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT + * mode. + * @set_cell_property: This should be implemented to handle changes in child + * cell properties for a given #GtkCellRenderer that were previously + * installed on the #GtkCellAreaClass with gtk_cell_area_class_install_cell_property(). + * @get_cell_property: This should be implemented to report the values of + * child cell properties for a given child #GtkCellRenderer. + * @focus: This virtual method should be implemented to navigate focus from + * cell to cell inside the #GtkCellArea. The #GtkCellArea should move + * focus from cell to cell inside the area and return %FALSE if focus + * logically leaves the area with the following exceptions: When the + * area contains no activatable cells, the entire area recieves focus. + * Focus should not be given to cells that are actually "focus siblings" + * of other sibling cells (see gtk_cell_area_get_focus_from_sibling()). + * Focus is set by calling gtk_cell_area_set_focus_cell(). + * @is_activatable: Returns whether the #GtkCellArea can respond to + * #GtkCellAreaClass.activate(), usually this does not need to be + * implemented since the base class takes care of this however it can + * be enhanced if the #GtkCellArea subclass can handle activation in + * other ways than activating its #GtkCellRenderers. + * @activate: This is called when the layouting widget rendering the + * #GtkCellArea activates the focus cell (see gtk_cell_area_get_focus_cell()). */ struct _GtkCellAreaClass { @@ -169,62 +181,62 @@ struct _GtkCellAreaClass /* Basic methods */ void (* add) (GtkCellArea *area, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); void (* remove) (GtkCellArea *area, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); void (* foreach) (GtkCellArea *area, - GtkCellCallback callback, - gpointer callback_data); + GtkCellCallback callback, + gpointer callback_data); void (* foreach_alloc) (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - const GdkRectangle *background_area, - GtkCellAllocCallback callback, - gpointer callback_data); + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + const GdkRectangle *background_area, + GtkCellAllocCallback callback, + gpointer callback_data); gint (* event) (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - GdkEvent *event, - const GdkRectangle *cell_area, - GtkCellRendererState flags); + GtkCellAreaContext *context, + GtkWidget *widget, + GdkEvent *event, + const GdkRectangle *cell_area, + GtkCellRendererState flags); void (* render) (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - cairo_t *cr, - const GdkRectangle *background_area, - const GdkRectangle *cell_area, - GtkCellRendererState flags, - gboolean paint_focus); + GtkCellAreaContext *context, + GtkWidget *widget, + cairo_t *cr, + const GdkRectangle *background_area, + const GdkRectangle *cell_area, + GtkCellRendererState flags, + gboolean paint_focus); void (* apply_attributes) (GtkCellArea *area, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gboolean is_expander, - gboolean is_expanded); + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gboolean is_expander, + gboolean is_expanded); /* Geometry */ GtkCellAreaContext *(* create_context) (GtkCellArea *area); GtkCellAreaContext *(* copy_context) (GtkCellArea *area, - GtkCellAreaContext *context); + GtkCellAreaContext *context); GtkSizeRequestMode (* get_request_mode) (GtkCellArea *area); void (* get_preferred_width) (GtkCellArea *area, - GtkCellAreaContext *context, + GtkCellAreaContext *context, GtkWidget *widget, gint *minimum_width, gint *natural_width); void (* get_preferred_height_for_width) (GtkCellArea *area, - GtkCellAreaContext *context, + GtkCellAreaContext *context, GtkWidget *widget, gint width, gint *minimum_height, gint *natural_height); void (* get_preferred_height) (GtkCellArea *area, - GtkCellAreaContext *context, + GtkCellAreaContext *context, GtkWidget *widget, gint *minimum_height, gint *natural_height); void (* get_preferred_width_for_height) (GtkCellArea *area, - GtkCellAreaContext *context, + GtkCellAreaContext *context, GtkWidget *widget, gint height, gint *minimum_width, @@ -232,26 +244,26 @@ struct _GtkCellAreaClass /* Cell Properties */ void (* set_cell_property) (GtkCellArea *area, - GtkCellRenderer *renderer, - guint property_id, - const GValue *value, - GParamSpec *pspec); + GtkCellRenderer *renderer, + guint property_id, + const GValue *value, + GParamSpec *pspec); void (* get_cell_property) (GtkCellArea *area, - GtkCellRenderer *renderer, - guint property_id, - GValue *value, - GParamSpec *pspec); + GtkCellRenderer *renderer, + guint property_id, + GValue *value, + GParamSpec *pspec); /* Focus */ gboolean (* focus) (GtkCellArea *area, - GtkDirectionType direction); + GtkDirectionType direction); gboolean (* is_activatable) (GtkCellArea *area); gboolean (* activate) (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - GtkCellRendererState flags, - gboolean edit_only); + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + GtkCellRendererState flags, + gboolean edit_only); /*< private >*/ @@ -270,193 +282,193 @@ GType gtk_cell_area_get_type (void) G_GNUC /* Basic methods */ void gtk_cell_area_add (GtkCellArea *area, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); void gtk_cell_area_remove (GtkCellArea *area, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); gboolean gtk_cell_area_has_renderer (GtkCellArea *area, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); void gtk_cell_area_foreach (GtkCellArea *area, - GtkCellCallback callback, - gpointer callback_data); + GtkCellCallback callback, + gpointer callback_data); void gtk_cell_area_foreach_alloc (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - const GdkRectangle *background_area, - GtkCellAllocCallback callback, - gpointer callback_data); + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + const GdkRectangle *background_area, + GtkCellAllocCallback callback, + gpointer callback_data); gint gtk_cell_area_event (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - GdkEvent *event, - const GdkRectangle *cell_area, - GtkCellRendererState flags); + GtkCellAreaContext *context, + GtkWidget *widget, + GdkEvent *event, + const GdkRectangle *cell_area, + GtkCellRendererState flags); void gtk_cell_area_render (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - cairo_t *cr, - const GdkRectangle *background_area, - const GdkRectangle *cell_area, - GtkCellRendererState flags, - gboolean paint_focus); + GtkCellAreaContext *context, + GtkWidget *widget, + cairo_t *cr, + const GdkRectangle *background_area, + const GdkRectangle *cell_area, + GtkCellRendererState flags, + gboolean paint_focus); void gtk_cell_area_set_style_detail (GtkCellArea *area, - const gchar *detail); + const gchar *detail); G_CONST_RETURN gchar *gtk_cell_area_get_style_detail (GtkCellArea *area); void gtk_cell_area_get_cell_allocation (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - GtkCellRenderer *renderer, - const GdkRectangle *cell_area, - GdkRectangle *allocation); + GtkCellAreaContext *context, + GtkWidget *widget, + GtkCellRenderer *renderer, + const GdkRectangle *cell_area, + GdkRectangle *allocation); GtkCellRenderer *gtk_cell_area_get_cell_at_position (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - gint x, - gint y, - GdkRectangle *alloc_area); + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + gint x, + gint y, + GdkRectangle *alloc_area); /* Geometry */ GtkCellAreaContext *gtk_cell_area_create_context (GtkCellArea *area); GtkCellAreaContext *gtk_cell_area_copy_context (GtkCellArea *area, - GtkCellAreaContext *context); + GtkCellAreaContext *context); GtkSizeRequestMode gtk_cell_area_get_request_mode (GtkCellArea *area); void gtk_cell_area_get_preferred_width (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint *minimum_width, - gint *natural_width); + GtkCellAreaContext *context, + GtkWidget *widget, + gint *minimum_width, + gint *natural_width); void gtk_cell_area_get_preferred_height_for_width (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint width, - gint *minimum_height, - gint *natural_height); + GtkCellAreaContext *context, + GtkWidget *widget, + gint width, + gint *minimum_height, + gint *natural_height); void gtk_cell_area_get_preferred_height (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint *minimum_height, - gint *natural_height); + GtkCellAreaContext *context, + GtkWidget *widget, + gint *minimum_height, + gint *natural_height); void gtk_cell_area_get_preferred_width_for_height (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint height, - gint *minimum_width, - gint *natural_width); + GtkCellAreaContext *context, + GtkWidget *widget, + gint height, + gint *minimum_width, + gint *natural_width); G_CONST_RETURN gchar *gtk_cell_area_get_current_path_string (GtkCellArea *area); /* Attributes */ void gtk_cell_area_apply_attributes (GtkCellArea *area, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gboolean is_expander, - gboolean is_expanded); + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gboolean is_expander, + gboolean is_expanded); void gtk_cell_area_attribute_connect (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *attribute, - gint column); + GtkCellRenderer *renderer, + const gchar *attribute, + gint column); void gtk_cell_area_attribute_disconnect (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *attribute); + GtkCellRenderer *renderer, + const gchar *attribute); /* Cell Properties */ void gtk_cell_area_class_install_cell_property (GtkCellAreaClass *aclass, - guint property_id, - GParamSpec *pspec); + guint property_id, + GParamSpec *pspec); GParamSpec* gtk_cell_area_class_find_cell_property (GtkCellAreaClass *aclass, - const gchar *property_name); + const gchar *property_name); GParamSpec** gtk_cell_area_class_list_cell_properties (GtkCellAreaClass *aclass, - guint *n_properties); + guint *n_properties); void gtk_cell_area_add_with_properties (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *first_prop_name, - ...) G_GNUC_NULL_TERMINATED; + GtkCellRenderer *renderer, + const gchar *first_prop_name, + ...) G_GNUC_NULL_TERMINATED; void gtk_cell_area_cell_set (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *first_prop_name, - ...) G_GNUC_NULL_TERMINATED; + GtkCellRenderer *renderer, + const gchar *first_prop_name, + ...) G_GNUC_NULL_TERMINATED; void gtk_cell_area_cell_get (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *first_prop_name, - ...) G_GNUC_NULL_TERMINATED; + GtkCellRenderer *renderer, + const gchar *first_prop_name, + ...) G_GNUC_NULL_TERMINATED; void gtk_cell_area_cell_set_valist (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *first_property_name, - va_list var_args); + GtkCellRenderer *renderer, + const gchar *first_property_name, + va_list var_args); void gtk_cell_area_cell_get_valist (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *first_property_name, - va_list var_args); + GtkCellRenderer *renderer, + const gchar *first_property_name, + va_list var_args); void gtk_cell_area_cell_set_property (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *property_name, - const GValue *value); + GtkCellRenderer *renderer, + const gchar *property_name, + const GValue *value); void gtk_cell_area_cell_get_property (GtkCellArea *area, - GtkCellRenderer *renderer, - const gchar *property_name, - GValue *value); + GtkCellRenderer *renderer, + const gchar *property_name, + GValue *value); /* Focus */ gboolean gtk_cell_area_is_activatable (GtkCellArea *area); gboolean gtk_cell_area_activate (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - GtkCellRendererState flags, - gboolean edit_only); + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + GtkCellRendererState flags, + gboolean edit_only); gboolean gtk_cell_area_focus (GtkCellArea *area, - GtkDirectionType direction); + GtkDirectionType direction); void gtk_cell_area_set_focus_cell (GtkCellArea *area, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); GtkCellRenderer *gtk_cell_area_get_focus_cell (GtkCellArea *area); /* Focus siblings */ void gtk_cell_area_add_focus_sibling (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkCellRenderer *sibling); + GtkCellRenderer *renderer, + GtkCellRenderer *sibling); void gtk_cell_area_remove_focus_sibling (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkCellRenderer *sibling); + GtkCellRenderer *renderer, + GtkCellRenderer *sibling); gboolean gtk_cell_area_is_focus_sibling (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkCellRenderer *sibling); + GtkCellRenderer *renderer, + GtkCellRenderer *sibling); G_CONST_RETURN GList *gtk_cell_area_get_focus_siblings (GtkCellArea *area, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); GtkCellRenderer *gtk_cell_area_get_focus_from_sibling (GtkCellArea *area, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); /* Cell Activation/Editing */ GtkCellRenderer *gtk_cell_area_get_edited_cell (GtkCellArea *area); GtkCellEditable *gtk_cell_area_get_edit_widget (GtkCellArea *area); gboolean gtk_cell_area_activate_cell (GtkCellArea *area, - GtkWidget *widget, - GtkCellRenderer *renderer, - GdkEvent *event, - const GdkRectangle *cell_area, - GtkCellRendererState flags); + GtkWidget *widget, + GtkCellRenderer *renderer, + GdkEvent *event, + const GdkRectangle *cell_area, + GtkCellRendererState flags); void gtk_cell_area_stop_editing (GtkCellArea *area, - gboolean canceled); + gboolean canceled); /* Functions for area implementations */ /* Distinguish the inner cell area from the whole requested area including margins */ void gtk_cell_area_inner_cell_area (GtkCellArea *area, - GtkWidget *widget, - const GdkRectangle *cell_area, - GdkRectangle *inner_area); + GtkWidget *widget, + const GdkRectangle *cell_area, + GdkRectangle *inner_area); /* Request the size of a cell while respecting the cell margins (requests are margin inclusive) */ void gtk_cell_area_request_renderer (GtkCellArea *area, - GtkCellRenderer *renderer, - GtkOrientation orientation, - GtkWidget *widget, - gint for_size, - gint *minimum_size, - gint *natural_size); + GtkCellRenderer *renderer, + GtkOrientation orientation, + GtkWidget *widget, + gint for_size, + gint *minimum_size, + gint *natural_size); G_END_DECLS diff --git a/gtk/gtkcellareabox.c b/gtk/gtkcellareabox.c index b1818ec919..90a0a07233 100644 --- a/gtk/gtkcellareabox.c +++ b/gtk/gtkcellareabox.c @@ -24,25 +24,27 @@ /** * SECTION:gtkcellareabox - * @Short_Description: A cell area that renders GtkCellRenderers into a row or a column + * @Short_Description: A cell area that renders GtkCellRenderers + * into a row or a column * @Title: GtkCellAreaBox * - * The #GtkCellAreaBox renders cell renderers into a row or a column depending on - * its #GtkOrientation. + * The #GtkCellAreaBox renders cell renderers into a row or a column + * depending on its #GtkOrientation. * * GtkCellAreaBox uses a notion of packing. Packing - * refers to adding cell renderers with reference to a particular position + * refers to adding cell renderers with reference to a particular position * in a #GtkCellAreaBox. There are two reference positions: the * start and the end of the box. - * When the #GtkCellAreaBox is oriented in the %GTK_ORIENTATION_VERTICAL orientation, - * the start is defined as the top of the box and the end is defined as the bottom. - * In the %GTK_ORIENTATION_HORIZONTAL orientation start is defined as the - * left side and the end is defined as the right side. + * When the #GtkCellAreaBox is oriented in the %GTK_ORIENTATION_VERTICAL + * orientation, the start is defined as the top of the box and the end is + * defined as the bottom. In the %GTK_ORIENTATION_HORIZONTAL orientation + * start is defined as the left side and the end is defined as the right + * side. * - * Alignments of #GtkCellRenderers rendered in adjacent rows can be configured - * by configuring the #GtkCellAreaBox:align child cell property with - * gtk_cell_area_cell_set_property() or by specifying the "align" argument - * to gtk_cell_area_box_pack_start() and gtk_cell_area_box_pack_end(). + * Alignments of #GtkCellRenderers rendered in adjacent rows can be + * configured by configuring the #GtkCellAreaBox:align child cell property + * with gtk_cell_area_cell_set_property() or by specifying the "align" + * argument to gtk_cell_area_box_pack_start() and gtk_cell_area_box_pack_end(). */ #include "config.h" @@ -58,82 +60,82 @@ static void gtk_cell_area_box_finalize (GObject *object); static void gtk_cell_area_box_dispose (GObject *object); static void gtk_cell_area_box_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); + guint prop_id, + const GValue *value, + GParamSpec *pspec); static void gtk_cell_area_box_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); + guint prop_id, + GValue *value, + GParamSpec *pspec); /* GtkCellAreaClass */ static void gtk_cell_area_box_add (GtkCellArea *area, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); static void gtk_cell_area_box_remove (GtkCellArea *area, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); static void gtk_cell_area_box_foreach (GtkCellArea *area, - GtkCellCallback callback, - gpointer callback_data); + GtkCellCallback callback, + gpointer callback_data); static void gtk_cell_area_box_foreach_alloc (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - const GdkRectangle *background_area, - GtkCellAllocCallback callback, - gpointer callback_data); + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + const GdkRectangle *background_area, + GtkCellAllocCallback callback, + gpointer callback_data); static void gtk_cell_area_box_set_cell_property (GtkCellArea *area, - GtkCellRenderer *renderer, - guint prop_id, - const GValue *value, - GParamSpec *pspec); + GtkCellRenderer *renderer, + guint prop_id, + const GValue *value, + GParamSpec *pspec); static void gtk_cell_area_box_get_cell_property (GtkCellArea *area, - GtkCellRenderer *renderer, - guint prop_id, - GValue *value, - GParamSpec *pspec); + GtkCellRenderer *renderer, + guint prop_id, + GValue *value, + GParamSpec *pspec); static GtkCellAreaContext *gtk_cell_area_box_create_context (GtkCellArea *area); static GtkCellAreaContext *gtk_cell_area_box_copy_context (GtkCellArea *area, - GtkCellAreaContext *context); + GtkCellAreaContext *context); static GtkSizeRequestMode gtk_cell_area_box_get_request_mode (GtkCellArea *area); static void gtk_cell_area_box_get_preferred_width (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint *minimum_width, - gint *natural_width); + GtkCellAreaContext *context, + GtkWidget *widget, + gint *minimum_width, + gint *natural_width); static void gtk_cell_area_box_get_preferred_height (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint *minimum_height, - gint *natural_height); + GtkCellAreaContext *context, + GtkWidget *widget, + gint *minimum_height, + gint *natural_height); static void gtk_cell_area_box_get_preferred_height_for_width (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint width, - gint *minimum_height, - gint *natural_height); + GtkCellAreaContext *context, + GtkWidget *widget, + gint width, + gint *minimum_height, + gint *natural_height); static void gtk_cell_area_box_get_preferred_width_for_height (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint height, - gint *minimum_width, - gint *natural_width); + GtkCellAreaContext *context, + GtkWidget *widget, + gint height, + gint *minimum_width, + gint *natural_width); static gboolean gtk_cell_area_box_focus (GtkCellArea *area, - GtkDirectionType direction); + GtkDirectionType direction); /* GtkCellLayoutIface */ static void gtk_cell_area_box_cell_layout_init (GtkCellLayoutIface *iface); static void gtk_cell_area_box_layout_pack_start (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer, - gboolean expand); + GtkCellRenderer *renderer, + gboolean expand); static void gtk_cell_area_box_layout_pack_end (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer, - gboolean expand); + GtkCellRenderer *renderer, + gboolean expand); static void gtk_cell_area_box_layout_reorder (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer, - gint position); + GtkCellRenderer *renderer, + gint position); static void gtk_cell_area_box_focus_changed (GtkCellArea *area, - GParamSpec *pspec, - GtkCellAreaBox *box); + GParamSpec *pspec, + GtkCellAreaBox *box); /* CellInfo/CellGroup metadata handling and convenience functions */ @@ -141,8 +143,8 @@ typedef struct { GtkCellRenderer *renderer; guint expand : 1; /* Whether the cell expands */ - guint pack : 1; /* Whether the cell is packed from the start or end */ - guint align : 1; /* Whether to align this cell's position with adjacent rows */ + guint pack : 1; /* Whether it is packed from the start or end */ + guint align : 1; /* Whether to align its position with adjacent rows */ } CellInfo; typedef struct { @@ -160,31 +162,31 @@ typedef struct { gint size; } AllocatedCell; -static CellInfo *cell_info_new (GtkCellRenderer *renderer, - GtkPackType pack, - gboolean expand, - gboolean align); +static CellInfo *cell_info_new (GtkCellRenderer *renderer, + GtkPackType pack, + gboolean expand, + gboolean align); static void cell_info_free (CellInfo *info); static gint cell_info_find (CellInfo *info, - GtkCellRenderer *renderer); + GtkCellRenderer *renderer); static AllocatedCell *allocated_cell_new (GtkCellRenderer *renderer, - gint position, - gint size); + gint position, + gint size); static void allocated_cell_free (AllocatedCell *cell); static GList *list_consecutive_cells (GtkCellAreaBox *box); static gint count_expand_groups (GtkCellAreaBox *box); static void context_weak_notify (GtkCellAreaBox *box, - GtkCellAreaBoxContext *dead_context); + GtkCellAreaBoxContext *dead_context); static void reset_contexts (GtkCellAreaBox *box); static void init_context_groups (GtkCellAreaBox *box); static void init_context_group (GtkCellAreaBox *box, - GtkCellAreaBoxContext *context); + GtkCellAreaBoxContext *context); static GSList *get_allocated_cells (GtkCellAreaBox *box, - GtkCellAreaBoxContext *context, - GtkWidget *widget, - gint width, - gint height); + GtkCellAreaBoxContext *context, + GtkWidget *widget, + gint width, + gint height); struct _GtkCellAreaBoxPrivate @@ -193,7 +195,8 @@ struct _GtkCellAreaBoxPrivate /* We hold on to the previously focused cell when navigating * up and down in a horizontal box (or left and right on a vertical one) - * this way we always re-enter the last focused cell. */ + * this way we always re-enter the last focused cell. + */ GtkCellRenderer *last_focus_cell; gulong focus_cell_id; @@ -205,7 +208,8 @@ struct _GtkCellAreaBoxPrivate gint spacing; /* We hold on to the rtl state from a widget we are requested for - * so that we can navigate focus correctly */ + * so that we can navigate focus correctly + */ gboolean rtl; }; @@ -223,12 +227,12 @@ enum { }; G_DEFINE_TYPE_WITH_CODE (GtkCellAreaBox, gtk_cell_area_box, GTK_TYPE_CELL_AREA, - G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT, - gtk_cell_area_box_cell_layout_init) - G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)); + G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_LAYOUT, + gtk_cell_area_box_cell_layout_init) + G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)); -#define OPPOSITE_ORIENTATION(orientation) \ - ((orientation) == GTK_ORIENTATION_HORIZONTAL ? \ +#define OPPOSITE_ORIENTATION(orientation) \ + ((orientation) == GTK_ORIENTATION_HORIZONTAL ? \ GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL) static void @@ -249,12 +253,14 @@ gtk_cell_area_box_init (GtkCellAreaBox *box) priv->rtl = FALSE; /* Watch whenever focus is given to a cell, even if it's not with keynav, - * this way we remember upon entry of the area where focus was last time around */ - priv->focus_cell_id = g_signal_connect (box, "notify::focus-cell", - G_CALLBACK (gtk_cell_area_box_focus_changed), box); + * this way we remember upon entry of the area where focus was last time + * around + */ + priv->focus_cell_id = g_signal_connect (box, "notify::focus-cell", + G_CALLBACK (gtk_cell_area_box_focus_changed), box); } -static void +static void gtk_cell_area_box_class_init (GtkCellAreaBoxClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); @@ -273,7 +279,7 @@ gtk_cell_area_box_class_init (GtkCellAreaBoxClass *class) area_class->foreach_alloc = gtk_cell_area_box_foreach_alloc; area_class->set_cell_property = gtk_cell_area_box_set_cell_property; area_class->get_cell_property = gtk_cell_area_box_get_cell_property; - + area_class->create_context = gtk_cell_area_box_create_context; area_class->copy_context = gtk_cell_area_box_copy_context; area_class->get_request_mode = gtk_cell_area_box_get_request_mode; @@ -297,31 +303,31 @@ gtk_cell_area_box_class_init (GtkCellAreaBoxClass *class) g_object_class_install_property (object_class, PROP_SPACING, g_param_spec_int ("spacing", - P_("Spacing"), - P_("Space which is inserted between cells"), - 0, - G_MAXINT, - 0, - GTK_PARAM_READWRITE)); + P_("Spacing"), + P_("Space which is inserted between cells"), + 0, + G_MAXINT, + 0, + GTK_PARAM_READWRITE)); /* Cell Properties */ /** * GtkCellAreaBox:expand: * - * Whether the cell renderer should receive extra space when the area receives - * more than its natural size. + * Whether the cell renderer should receive extra space + * when the area receives more than its natural size. * * Since: 3.0 */ gtk_cell_area_class_install_cell_property (area_class, - CELL_PROP_EXPAND, - g_param_spec_boolean - ("expand", - P_("Expand"), - P_("Whether the cell expands"), - FALSE, - GTK_PARAM_READWRITE)); - + CELL_PROP_EXPAND, + g_param_spec_boolean + ("expand", + P_("Expand"), + P_("Whether the cell expands"), + FALSE, + GTK_PARAM_READWRITE)); + /** * GtkCellAreaBox:align: * @@ -330,31 +336,31 @@ gtk_cell_area_box_class_init (GtkCellAreaBoxClass *class) * Since: 3.0 */ gtk_cell_area_class_install_cell_property (area_class, - CELL_PROP_ALIGN, - g_param_spec_boolean - ("align", - P_("Align"), - P_("Whether cell should align with adjacent rows"), - TRUE, - GTK_PARAM_READWRITE)); + CELL_PROP_ALIGN, + g_param_spec_boolean + ("align", + P_("Align"), + P_("Whether cell should align with adjacent rows"), + TRUE, + GTK_PARAM_READWRITE)); /** * GtkCellAreaBox:pack-type: * - * A GtkPackType indicating whether the cell renderer is packed with reference to the - * start or end of the area. + * A GtkPackType indicating whether the cell renderer is packed + * with reference to the start or end of the area. * * Since: 3.0 */ gtk_cell_area_class_install_cell_property (area_class, - CELL_PROP_PACK_TYPE, - g_param_spec_enum - ("pack-type", - P_("Pack Type"), - P_("A GtkPackType indicating whether the cell is packed with " - "reference to the start or end of the cell area"), - GTK_TYPE_PACK_TYPE, GTK_PACK_START, - GTK_PARAM_READWRITE)); + CELL_PROP_PACK_TYPE, + g_param_spec_enum + ("pack-type", + P_("Pack Type"), + P_("A GtkPackType indicating whether the cell is packed with " + "reference to the start or end of the cell area"), + GTK_TYPE_PACK_TYPE, GTK_PACK_START, + GTK_PARAM_READWRITE)); g_type_class_add_private (object_class, sizeof (GtkCellAreaBoxPrivate)); } @@ -364,13 +370,13 @@ gtk_cell_area_box_class_init (GtkCellAreaBoxClass *class) * CellInfo/CellGroup basics and convenience functions * *************************************************************/ static CellInfo * -cell_info_new (GtkCellRenderer *renderer, - GtkPackType pack, - gboolean expand, - gboolean align) +cell_info_new (GtkCellRenderer *renderer, + GtkPackType pack, + gboolean expand, + gboolean align) { CellInfo *info = g_slice_new (CellInfo); - + info->renderer = g_object_ref_sink (renderer); info->pack = pack; info->expand = expand; @@ -389,15 +395,15 @@ cell_info_free (CellInfo *info) static gint cell_info_find (CellInfo *info, - GtkCellRenderer *renderer) + GtkCellRenderer *renderer) { return (info->renderer == renderer) ? 0 : -1; } static AllocatedCell * allocated_cell_new (GtkCellRenderer *renderer, - gint position, - gint size) + gint position, + gint size) { AllocatedCell *cell = g_slice_new (AllocatedCell); @@ -421,23 +427,23 @@ list_consecutive_cells (GtkCellAreaBox *box) GList *l, *consecutive_cells = NULL, *pack_end_cells = NULL; CellInfo *info; - /* List cells in consecutive order taking their - * PACK_START/PACK_END options into account + /* List cells in consecutive order taking their + * PACK_START/PACK_END options into account */ for (l = priv->cells; l; l = l->next) { info = l->data; - + if (info->pack == GTK_PACK_START) - consecutive_cells = g_list_prepend (consecutive_cells, info); + consecutive_cells = g_list_prepend (consecutive_cells, info); } for (l = priv->cells; l; l = l->next) { info = l->data; - + if (info->pack == GTK_PACK_END) - pack_end_cells = g_list_prepend (pack_end_cells, info); + pack_end_cells = g_list_prepend (pack_end_cells, info); } consecutive_cells = g_list_reverse (consecutive_cells); @@ -447,9 +453,9 @@ list_consecutive_cells (GtkCellAreaBox *box) } static void -cell_groups_clear (GtkCellAreaBox *box) +cell_groups_clear (GtkCellAreaBox *box) { - GtkCellAreaBoxPrivate *priv = box->priv; + GtkCellAreaBoxPrivate *priv = box->priv; gint i; for (i = 0; i < priv->groups->len; i++) @@ -465,7 +471,7 @@ cell_groups_clear (GtkCellAreaBox *box) static void cell_groups_rebuild (GtkCellAreaBox *box) { - GtkCellAreaBoxPrivate *priv = box->priv; + GtkCellAreaBoxPrivate *priv = box->priv; CellGroup group = { 0, }; CellGroup *group_ptr; GList *cells, *l; @@ -488,20 +494,20 @@ cell_groups_rebuild (GtkCellAreaBox *box) /* A new group starts with any aligned cell, the first group is implied */ if (info->align && l != cells) - { - memset (&group, 0x0, sizeof (CellGroup)); - group.id = ++id; + { + memset (&group, 0x0, sizeof (CellGroup)); + group.id = ++id; - g_array_append_val (priv->groups, group); - group_ptr = &g_array_index (priv->groups, CellGroup, id); - } + g_array_append_val (priv->groups, group); + group_ptr = &g_array_index (priv->groups, CellGroup, id); + } group_ptr->cells = g_list_prepend (group_ptr->cells, info); group_ptr->n_cells++; /* A group expands if it contains any expand cells */ if (info->expand) - group_ptr->expand_cells++; + group_ptr->expand_cells++; } g_list_free (cells); @@ -518,8 +524,8 @@ cell_groups_rebuild (GtkCellAreaBox *box) } static gint -count_visible_cells (CellGroup *group, - gint *expand_cells) +count_visible_cells (CellGroup *group, + gint *expand_cells) { GList *l; gint visible_cells = 0; @@ -530,12 +536,12 @@ count_visible_cells (CellGroup *group, CellInfo *info = l->data; if (gtk_cell_renderer_get_visible (info->renderer)) - { - visible_cells++; + { + visible_cells++; - if (info->expand) - n_expand_cells++; - } + if (info->expand) + n_expand_cells++; + } } if (expand_cells) @@ -556,15 +562,15 @@ count_expand_groups (GtkCellAreaBox *box) CellGroup *group = &g_array_index (priv->groups, CellGroup, i); if (group->expand_cells > 0) - expand_groups++; + expand_groups++; } return expand_groups; } -static void +static void context_weak_notify (GtkCellAreaBox *box, - GtkCellAreaBoxContext *dead_context) + GtkCellAreaBoxContext *dead_context) { GtkCellAreaBoxPrivate *priv = box->priv; @@ -573,7 +579,7 @@ context_weak_notify (GtkCellAreaBox *box, static void init_context_group (GtkCellAreaBox *box, - GtkCellAreaBoxContext *context) + GtkCellAreaBoxContext *context) { GtkCellAreaBoxPrivate *priv = box->priv; gint *expand_groups, i; @@ -598,8 +604,8 @@ init_context_groups (GtkCellAreaBox *box) GtkCellAreaBoxPrivate *priv = box->priv; GSList *l; - /* When the box's groups are reconstructed, contexts need to - * be reinitialized. + /* When the box's groups are reconstructed, + * contexts need to be reinitialized. */ for (l = priv->contexts; l; l = l->next) { @@ -633,9 +639,9 @@ reset_contexts (GtkCellAreaBox *box) */ static GSList * allocate_cells_manually (GtkCellAreaBox *box, - GtkWidget *widget, - gint width, - gint height) + GtkWidget *widget, + gint width, + gint height) { GtkCellAreaBoxPrivate *priv = box->priv; GList *cells, *l; @@ -650,9 +656,11 @@ allocate_cells_manually (GtkCellAreaBox *box, if (!priv->cells) return NULL; - /* For vertical oriented boxes, we just let the cell renderers realign themselves for rtl */ + /* For vertical oriented boxes, we just let the cell renderers + * realign themselves for rtl + */ rtl = (priv->orientation == GTK_ORIENTATION_HORIZONTAL && - gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); + gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); cells = list_consecutive_cells (box); @@ -689,13 +697,13 @@ allocate_cells_manually (GtkCellAreaBox *box, CellInfo *info = l->data; if (!gtk_cell_renderer_get_visible (info->renderer)) - continue; + continue; gtk_cell_area_request_renderer (GTK_CELL_AREA (box), info->renderer, - priv->orientation, - widget, for_size, - &sizes[i].minimum_size, - &sizes[i].natural_size); + priv->orientation, + widget, for_size, + &sizes[i].minimum_size, + &sizes[i].natural_size); avail_size -= sizes[i].minimum_size; @@ -727,24 +735,24 @@ allocate_cells_manually (GtkCellAreaBox *box, AllocatedCell *cell; if (info->expand) - { - sizes[i].minimum_size += extra_size; - if (extra_extra) - { - sizes[i].minimum_size++; - extra_extra--; - } - } - + { + sizes[i].minimum_size += extra_size; + if (extra_extra) + { + sizes[i].minimum_size++; + extra_extra--; + } + } + if (rtl) - cell = allocated_cell_new (info->renderer, - full_size - (position + sizes[i].minimum_size), - sizes[i].minimum_size); + cell = allocated_cell_new (info->renderer, + full_size - (position + sizes[i].minimum_size), + sizes[i].minimum_size); else - cell = allocated_cell_new (info->renderer, position, sizes[i].minimum_size); + cell = allocated_cell_new (info->renderer, position, sizes[i].minimum_size); allocated_cells = g_slist_prepend (allocated_cells, cell); - + position += sizes[i].minimum_size; position += priv->spacing; } @@ -753,7 +761,8 @@ allocate_cells_manually (GtkCellAreaBox *box, g_list_free (cells); /* Note it might not be important to reverse the list here at all, - * we have the correct positions, no need to allocate from left to right */ + * we have the correct positions, no need to allocate from left to right + */ return g_slist_reverse (allocated_cells); } @@ -763,10 +772,10 @@ allocate_cells_manually (GtkCellAreaBox *box, */ static GSList * get_allocated_cells (GtkCellAreaBox *box, - GtkCellAreaBoxContext *context, - GtkWidget *widget, - gint width, - gint height) + GtkCellAreaBoxContext *context, + GtkWidget *widget, + gint width, + gint height) { GtkCellAreaBoxAllocation *group_allocs; GtkCellArea *area = GTK_CELL_AREA (box); @@ -792,131 +801,137 @@ get_allocated_cells (GtkCellAreaBox *box, for_size = width; } - /* For vertical oriented boxes, we just let the cell renderers realign themselves for rtl */ + /* For vertical oriented boxes, we just let the cell renderers + * realign themselves for rtl + */ rtl = (priv->orientation == GTK_ORIENTATION_HORIZONTAL && - gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); + gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); for (i = 0; i < n_allocs; i++) { - /* We dont always allocate all groups, sometimes the requested group has only invisible - * cells for every row, hence the usage of group_allocs[i].group_idx here + /* We dont always allocate all groups, sometimes the requested + * group has only invisible cells for every row, hence the usage + * of group_allocs[i].group_idx here */ CellGroup *group = &g_array_index (priv->groups, CellGroup, group_allocs[i].group_idx); /* Exception for single cell groups */ if (group->n_cells == 1) - { - CellInfo *info = group->cells->data; - AllocatedCell *cell; - - if (rtl) - cell = allocated_cell_new (info->renderer, - full_size - (group_allocs[i].position + group_allocs[i].size), - group_allocs[i].size); - else - cell = allocated_cell_new (info->renderer, group_allocs[i].position, group_allocs[i].size); - - allocated_cells = g_slist_prepend (allocated_cells, cell); - } + { + CellInfo *info = group->cells->data; + AllocatedCell *cell; + + if (rtl) + cell = allocated_cell_new (info->renderer, + full_size - (group_allocs[i].position + group_allocs[i].size), + group_allocs[i].size); + else + cell = allocated_cell_new (info->renderer, group_allocs[i].position, group_allocs[i].size); + + allocated_cells = g_slist_prepend (allocated_cells, cell); + } else - { - GtkRequestedSize *sizes; - gint avail_size, position; - gint visible_cells, expand_cells; - gint extra_size, extra_extra; + { + GtkRequestedSize *sizes; + gint avail_size, position; + gint visible_cells, expand_cells; + gint extra_size, extra_extra; - visible_cells = count_visible_cells (group, &expand_cells); + visible_cells = count_visible_cells (group, &expand_cells); - /* If this row has no visible cells in this group, just - * skip the allocation */ - if (visible_cells == 0) - continue; + /* If this row has no visible cells in this group, just + * skip the allocation + */ + if (visible_cells == 0) + continue; - /* Offset the allocation to the group position and allocate into - * the group's available size */ - position = group_allocs[i].position; - avail_size = group_allocs[i].size; + /* Offset the allocation to the group position + * and allocate into the group's available size + */ + position = group_allocs[i].position; + avail_size = group_allocs[i].size; - sizes = g_new (GtkRequestedSize, visible_cells); + sizes = g_new (GtkRequestedSize, visible_cells); - for (j = 0, cell_list = group->cells; cell_list; cell_list = cell_list->next) - { - CellInfo *info = cell_list->data; + for (j = 0, cell_list = group->cells; cell_list; cell_list = cell_list->next) + { + CellInfo *info = cell_list->data; - if (!gtk_cell_renderer_get_visible (info->renderer)) - continue; + if (!gtk_cell_renderer_get_visible (info->renderer)) + continue; - gtk_cell_area_request_renderer (area, info->renderer, - priv->orientation, - widget, for_size, - &sizes[j].minimum_size, - &sizes[j].natural_size); + gtk_cell_area_request_renderer (area, info->renderer, + priv->orientation, + widget, for_size, + &sizes[j].minimum_size, + &sizes[j].natural_size); - sizes[j].data = info; - avail_size -= sizes[j].minimum_size; + sizes[j].data = info; + avail_size -= sizes[j].minimum_size; - j++; - } + j++; + } - /* Distribute cells naturally within the group */ - avail_size -= (visible_cells - 1) * priv->spacing; + /* Distribute cells naturally within the group */ + avail_size -= (visible_cells - 1) * priv->spacing; if (avail_size > 0) avail_size = gtk_distribute_natural_allocation (avail_size, visible_cells, sizes); else avail_size = 0; - /* Calculate/distribute expand for cells */ - if (expand_cells > 0) - { - extra_size = avail_size / expand_cells; - extra_extra = avail_size % expand_cells; - } - else - extra_size = extra_extra = 0; - - /* Create the allocated cells (loop only over visible cells here) */ - for (j = 0; j < visible_cells; j++) - { - CellInfo *info = sizes[j].data; - AllocatedCell *cell; - - if (info->expand) - { - sizes[j].minimum_size += extra_size; - if (extra_extra) - { - sizes[j].minimum_size++; - extra_extra--; - } - } - - if (rtl) - cell = allocated_cell_new (info->renderer, - full_size - (position + sizes[j].minimum_size), - sizes[j].minimum_size); - else - cell = allocated_cell_new (info->renderer, position, sizes[j].minimum_size); - - allocated_cells = g_slist_prepend (allocated_cells, cell); - - position += sizes[j].minimum_size; - position += priv->spacing; - } - - g_free (sizes); - } + /* Calculate/distribute expand for cells */ + if (expand_cells > 0) + { + extra_size = avail_size / expand_cells; + extra_extra = avail_size % expand_cells; + } + else + extra_size = extra_extra = 0; + + /* Create the allocated cells (loop only over visible cells here) */ + for (j = 0; j < visible_cells; j++) + { + CellInfo *info = sizes[j].data; + AllocatedCell *cell; + + if (info->expand) + { + sizes[j].minimum_size += extra_size; + if (extra_extra) + { + sizes[j].minimum_size++; + extra_extra--; + } + } + + if (rtl) + cell = allocated_cell_new (info->renderer, + full_size - (position + sizes[j].minimum_size), + sizes[j].minimum_size); + else + cell = allocated_cell_new (info->renderer, position, sizes[j].minimum_size); + + allocated_cells = g_slist_prepend (allocated_cells, cell); + + position += sizes[j].minimum_size; + position += priv->spacing; + } + + g_free (sizes); + } } /* Note it might not be important to reverse the list here at all, - * we have the correct positions, no need to allocate from left to right */ + * we have the correct positions, no need to allocate from left to right + */ return g_slist_reverse (allocated_cells); } static void gtk_cell_area_box_focus_changed (GtkCellArea *area, - GParamSpec *pspec, - GtkCellAreaBox *box) + GParamSpec *pspec, + GtkCellAreaBox *box) { if (gtk_cell_area_get_focus_cell (area)) box->priv->last_focus_cell = gtk_cell_area_get_focus_cell (area); @@ -942,7 +957,7 @@ gtk_cell_area_box_finalize (GObject *object) /* Free the cell grouping info */ cell_groups_clear (box); g_array_free (priv->groups, TRUE); - + G_OBJECT_CLASS (gtk_cell_area_box_parent_class)->finalize (object); } @@ -954,9 +969,9 @@ gtk_cell_area_box_dispose (GObject *object) static void gtk_cell_area_box_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) + guint prop_id, + const GValue *value, + GParamSpec *pspec) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (object); @@ -979,9 +994,9 @@ gtk_cell_area_box_set_property (GObject *object, static void gtk_cell_area_box_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) + guint prop_id, + GValue *value, + GParamSpec *pspec) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (object); @@ -1002,17 +1017,17 @@ gtk_cell_area_box_get_property (GObject *object, /************************************************************* * GtkCellAreaClass * *************************************************************/ -static void +static void gtk_cell_area_box_add (GtkCellArea *area, - GtkCellRenderer *renderer) + GtkCellRenderer *renderer) { gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (area), - renderer, FALSE, TRUE); + renderer, FALSE, TRUE); } static void gtk_cell_area_box_remove (GtkCellArea *area, - GtkCellRenderer *renderer) + GtkCellRenderer *renderer) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxPrivate *priv = box->priv; @@ -1021,8 +1036,8 @@ gtk_cell_area_box_remove (GtkCellArea *area, if (priv->last_focus_cell == renderer) priv->last_focus_cell = NULL; - node = g_list_find_custom (priv->cells, renderer, - (GCompareFunc)cell_info_find); + node = g_list_find_custom (priv->cells, renderer, + (GCompareFunc)cell_info_find); if (node) { @@ -1041,8 +1056,8 @@ gtk_cell_area_box_remove (GtkCellArea *area, static void gtk_cell_area_box_foreach (GtkCellArea *area, - GtkCellCallback callback, - gpointer callback_data) + GtkCellCallback callback, + gpointer callback_data) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxPrivate *priv = box->priv; @@ -1053,18 +1068,18 @@ gtk_cell_area_box_foreach (GtkCellArea *area, CellInfo *info = list->data; if (callback (info->renderer, callback_data)) - break; + break; } } static void gtk_cell_area_box_foreach_alloc (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - const GdkRectangle *cell_area, - const GdkRectangle *background_area, - GtkCellAllocCallback callback, - gpointer callback_data) + GtkCellAreaContext *context, + GtkWidget *widget, + const GdkRectangle *cell_area, + const GdkRectangle *background_area, + GtkCellAllocCallback callback, + gpointer callback_data) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxPrivate *priv = box->priv; @@ -1074,80 +1089,87 @@ gtk_cell_area_box_foreach_alloc (GtkCellArea *area, gboolean rtl; rtl = (priv->orientation == GTK_ORIENTATION_HORIZONTAL && - gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); + gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); cell_alloc = *cell_area; /* Get a list of cells with allocation sizes decided regardless - * of alignments and pack order etc. */ - allocated_cells = get_allocated_cells (box, box_context, widget, - cell_area->width, cell_area->height); + * of alignments and pack order etc. + */ + allocated_cells = get_allocated_cells (box, box_context, widget, + cell_area->width, cell_area->height); for (l = allocated_cells; l; l = l->next) { AllocatedCell *cell = l->data; if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) - { - cell_alloc.x = cell_area->x + cell->position; - cell_alloc.width = cell->size; - } + { + cell_alloc.x = cell_area->x + cell->position; + cell_alloc.width = cell->size; + } else - { - cell_alloc.y = cell_area->y + cell->position; - cell_alloc.height = cell->size; - } - - /* Stop iterating over cells if they flow out of the render area, - * this can happen because the render area can actually be - * smaller than the requested area (treeview columns can + { + cell_alloc.y = cell_area->y + cell->position; + cell_alloc.height = cell->size; + } + + /* Stop iterating over cells if they flow out of the render + * area, this can happen because the render area can actually + * be smaller than the requested area (treeview columns can * be user resizable and can be resized to be smaller than - * the actual requested area). */ + * the actual requested area). + */ if (cell_alloc.x > cell_area->x + cell_area->width || - cell_alloc.x + cell_alloc.width < cell_area->x || - cell_alloc.y > cell_area->y + cell_area->height) - break; - - /* Special case for the last cell (or first cell in rtl)... let the last cell consume - * the remaining space in the area (the last cell is allowed to consume the remaining - * space if the space given for rendering is actually larger than allocation, this can - * happen in the expander GtkTreeViewColumn where only the deepest depth column - * receives the allocation... shallow columns recieve more width). */ + cell_alloc.x + cell_alloc.width < cell_area->x || + cell_alloc.y > cell_area->y + cell_area->height) + break; + + /* Special case for the last cell (or first cell in rtl)... + * let the last cell consume the remaining space in the area + * (the last cell is allowed to consume the remaining space if + * the space given for rendering is actually larger than allocation, + * this can happen in the expander GtkTreeViewColumn where only the + * deepest depth column receives the allocation... shallow columns + * receive more width). */ if (!l->next) - { - if (rtl) - { - /* Fill the leading space for the first cell in the area (still last in the list) */ - cell_alloc.width = (cell_alloc.x - cell_area->x) + cell_alloc.width; - cell_alloc.x = cell_area->x; - } - else - { - cell_alloc.width = cell_area->x + cell_area->width - cell_alloc.x; - cell_alloc.height = cell_area->y + cell_area->height - cell_alloc.y; - } - } + { + if (rtl) + { + /* Fill the leading space for the first cell in the area + * (still last in the list) + */ + cell_alloc.width = (cell_alloc.x - cell_area->x) + cell_alloc.width; + cell_alloc.x = cell_area->x; + } + else + { + cell_alloc.width = cell_area->x + cell_area->width - cell_alloc.x; + cell_alloc.height = cell_area->y + cell_area->height - cell_alloc.y; + } + } else - { - /* If the cell we are rendering doesnt fit into the remaining space, clip it - * so that the underlying renderer has a chance to deal with it (for instance - * text renderers get a chance to ellipsize). - */ - if (cell_alloc.x + cell_alloc.width > cell_area->x + cell_area->width) - cell_alloc.width = cell_area->x + cell_area->width - cell_alloc.x; - - if (cell_alloc.y + cell_alloc.height > cell_area->y + cell_area->height) - cell_alloc.height = cell_area->y + cell_area->height - cell_alloc.y; - } + { + /* If the cell we are rendering doesnt fit into the remaining space, + * clip it so that the underlying renderer has a chance to deal with + * it (for instance text renderers get a chance to ellipsize). + */ + if (cell_alloc.x + cell_alloc.width > cell_area->x + cell_area->width) + cell_alloc.width = cell_area->x + cell_area->width - cell_alloc.x; + + if (cell_alloc.y + cell_alloc.height > cell_area->y + cell_area->height) + cell_alloc.height = cell_area->y + cell_area->height - cell_alloc.y; + } /* Add portions of the background_area to the cell_alloc - * to create the cell_background */ + * to create the cell_background + */ cell_background = cell_alloc; if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) - { - if (l == allocated_cells) - { + { + if (l == allocated_cells) + { /* Add the depth to the first cell */ if (rtl) { @@ -1159,9 +1181,9 @@ gtk_cell_area_box_foreach_alloc (GtkCellArea *area, cell_background.width += cell_area->x - background_area->x; cell_background.x = background_area->x; } - } + } - if (l->next == NULL) + if (l->next == NULL) { /* Grant this cell the remaining space */ int remain = cell_background.x - background_area->x; @@ -1172,27 +1194,27 @@ gtk_cell_area_box_foreach_alloc (GtkCellArea *area, cell_background.width = background_area->width - remain; } - cell_background.y = background_area->y; - cell_background.height = background_area->height; - } + cell_background.y = background_area->y; + cell_background.height = background_area->height; + } else - { - if (l == allocated_cells) - { - cell_background.height += cell_background.y - background_area->y; - cell_background.y = background_area->y; - } + { + if (l == allocated_cells) + { + cell_background.height += cell_background.y - background_area->y; + cell_background.y = background_area->y; + } - if (l->next == NULL) - cell_background.height = - background_area->height - (cell_background.y - background_area->y); + if (l->next == NULL) + cell_background.height = + background_area->height - (cell_background.y - background_area->y); - cell_background.x = background_area->x; - cell_background.width = background_area->width; - } + cell_background.x = background_area->x; + cell_background.width = background_area->width; + } if (callback (cell->renderer, &cell_alloc, &cell_background, callback_data)) - break; + break; } g_slist_foreach (allocated_cells, (GFunc)allocated_cell_free, NULL); @@ -1201,12 +1223,12 @@ gtk_cell_area_box_foreach_alloc (GtkCellArea *area, static void gtk_cell_area_box_set_cell_property (GtkCellArea *area, - GtkCellRenderer *renderer, - guint prop_id, - const GValue *value, - GParamSpec *pspec) + GtkCellRenderer *renderer, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { - GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); + GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxPrivate *priv = box->priv; GList *node; CellInfo *info; @@ -1214,8 +1236,8 @@ gtk_cell_area_box_set_cell_property (GtkCellArea *area, gboolean val; GtkPackType pack_type; - node = g_list_find_custom (priv->cells, renderer, - (GCompareFunc)cell_info_find); + node = g_list_find_custom (priv->cells, renderer, + (GCompareFunc)cell_info_find); if (!node) return; @@ -1227,30 +1249,30 @@ gtk_cell_area_box_set_cell_property (GtkCellArea *area, val = g_value_get_boolean (value); if (info->expand != val) - { - info->expand = val; - rebuild = TRUE; - } + { + info->expand = val; + rebuild = TRUE; + } break; case CELL_PROP_ALIGN: val = g_value_get_boolean (value); if (info->align != val) - { - info->align = val; - rebuild = TRUE; - } + { + info->align = val; + rebuild = TRUE; + } break; case CELL_PROP_PACK_TYPE: pack_type = g_value_get_enum (value); if (info->pack != pack_type) - { - info->pack = pack_type; - rebuild = TRUE; - } + { + info->pack = pack_type; + rebuild = TRUE; + } break; default: GTK_CELL_AREA_WARN_INVALID_CELL_PROPERTY_ID (area, prop_id, pspec); @@ -1264,18 +1286,18 @@ gtk_cell_area_box_set_cell_property (GtkCellArea *area, static void gtk_cell_area_box_get_cell_property (GtkCellArea *area, - GtkCellRenderer *renderer, - guint prop_id, - GValue *value, - GParamSpec *pspec) + GtkCellRenderer *renderer, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); + GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxPrivate *priv = box->priv; GList *node; CellInfo *info; - node = g_list_find_custom (priv->cells, renderer, - (GCompareFunc)cell_info_find); + node = g_list_find_custom (priv->cells, renderer, + (GCompareFunc)cell_info_find); if (!node) return; @@ -1307,8 +1329,8 @@ gtk_cell_area_box_create_context (GtkCellArea *area) GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxPrivate *priv = box->priv; GtkCellAreaContext *context = - (GtkCellAreaContext *)g_object_new (GTK_TYPE_CELL_AREA_BOX_CONTEXT, - "area", area, NULL); + (GtkCellAreaContext *)g_object_new (GTK_TYPE_CELL_AREA_BOX_CONTEXT, + "area", area, NULL); priv->contexts = g_slist_prepend (priv->contexts, context); @@ -1322,13 +1344,13 @@ gtk_cell_area_box_create_context (GtkCellArea *area) static GtkCellAreaContext * gtk_cell_area_box_copy_context (GtkCellArea *area, - GtkCellAreaContext *context) + GtkCellAreaContext *context) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxPrivate *priv = box->priv; - GtkCellAreaContext *copy = - (GtkCellAreaContext *)gtk_cell_area_box_context_copy (GTK_CELL_AREA_BOX (area), - GTK_CELL_AREA_BOX_CONTEXT (context)); + GtkCellAreaContext *copy = + (GtkCellAreaContext *)gtk_cell_area_box_context_copy (GTK_CELL_AREA_BOX (area), + GTK_CELL_AREA_BOX_CONTEXT (context)); priv->contexts = g_slist_prepend (priv->contexts, copy); @@ -1337,7 +1359,7 @@ gtk_cell_area_box_copy_context (GtkCellArea *area, return copy; } -static GtkSizeRequestMode +static GtkSizeRequestMode gtk_cell_area_box_get_request_mode (GtkCellArea *area) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); @@ -1350,12 +1372,12 @@ gtk_cell_area_box_get_request_mode (GtkCellArea *area) static void compute_size (GtkCellAreaBox *box, - GtkOrientation orientation, - GtkCellAreaBoxContext *context, - GtkWidget *widget, - gint for_size, - gint *minimum_size, - gint *natural_size) + GtkOrientation orientation, + GtkCellAreaBoxContext *context, + GtkWidget *widget, + gint for_size, + gint *minimum_size, + gint *natural_size) { GtkCellAreaBoxPrivate *priv = box->priv; GtkCellArea *area = GTK_CELL_AREA (box); @@ -1363,7 +1385,7 @@ compute_size (GtkCellAreaBox *box, gint i; gint min_size = 0; gint nat_size = 0; - + for (i = 0; i < priv->groups->len; i++) { CellGroup *group = &g_array_index (priv->groups, CellGroup, i); @@ -1371,60 +1393,60 @@ compute_size (GtkCellAreaBox *box, gint group_nat_size = 0; for (list = group->cells; list; list = list->next) - { - CellInfo *info = list->data; - gint renderer_min_size, renderer_nat_size; - - if (!gtk_cell_renderer_get_visible (info->renderer)) - continue; - - gtk_cell_area_request_renderer (area, info->renderer, orientation, widget, for_size, - &renderer_min_size, &renderer_nat_size); - - if (orientation == priv->orientation) - { - if (min_size > 0) - { - min_size += priv->spacing; - nat_size += priv->spacing; - } - - if (group_min_size > 0) - { - group_min_size += priv->spacing; - group_nat_size += priv->spacing; - } - - min_size += renderer_min_size; - nat_size += renderer_nat_size; - group_min_size += renderer_min_size; - group_nat_size += renderer_nat_size; - } - else - { - min_size = MAX (min_size, renderer_min_size); - nat_size = MAX (nat_size, renderer_nat_size); - group_min_size = MAX (group_min_size, renderer_min_size); - group_nat_size = MAX (group_nat_size, renderer_nat_size); - } - } + { + CellInfo *info = list->data; + gint renderer_min_size, renderer_nat_size; + + if (!gtk_cell_renderer_get_visible (info->renderer)) + continue; + + gtk_cell_area_request_renderer (area, info->renderer, orientation, widget, for_size, + &renderer_min_size, &renderer_nat_size); + + if (orientation == priv->orientation) + { + if (min_size > 0) + { + min_size += priv->spacing; + nat_size += priv->spacing; + } + + if (group_min_size > 0) + { + group_min_size += priv->spacing; + group_nat_size += priv->spacing; + } + + min_size += renderer_min_size; + nat_size += renderer_nat_size; + group_min_size += renderer_min_size; + group_nat_size += renderer_nat_size; + } + else + { + min_size = MAX (min_size, renderer_min_size); + nat_size = MAX (nat_size, renderer_nat_size); + group_min_size = MAX (group_min_size, renderer_min_size); + group_nat_size = MAX (group_nat_size, renderer_nat_size); + } + } if (orientation == GTK_ORIENTATION_HORIZONTAL) - { - if (for_size < 0) - gtk_cell_area_box_context_push_group_width (context, group->id, group_min_size, group_nat_size); - else - gtk_cell_area_box_context_push_group_width_for_height (context, group->id, for_size, - group_min_size, group_nat_size); - } + { + if (for_size < 0) + gtk_cell_area_box_context_push_group_width (context, group->id, group_min_size, group_nat_size); + else + gtk_cell_area_box_context_push_group_width_for_height (context, group->id, for_size, + group_min_size, group_nat_size); + } else - { - if (for_size < 0) - gtk_cell_area_box_context_push_group_height (context, group->id, group_min_size, group_nat_size); - else - gtk_cell_area_box_context_push_group_height_for_width (context, group->id, for_size, - group_min_size, group_nat_size); - } + { + if (for_size < 0) + gtk_cell_area_box_context_push_group_height (context, group->id, group_min_size, group_nat_size); + else + gtk_cell_area_box_context_push_group_height_for_width (context, group->id, for_size, + group_min_size, group_nat_size); + } } *minimum_size = min_size; @@ -1432,15 +1454,15 @@ compute_size (GtkCellAreaBox *box, /* Update rtl state for focus navigation to work */ priv->rtl = (priv->orientation == GTK_ORIENTATION_HORIZONTAL && - gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); + gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); } GtkRequestedSize * get_group_sizes (GtkCellArea *area, - CellGroup *group, - GtkOrientation orientation, - GtkWidget *widget, - gint *n_sizes) + CellGroup *group, + GtkOrientation orientation, + GtkWidget *widget, + gint *n_sizes) { GtkRequestedSize *sizes; GList *l; @@ -1454,14 +1476,14 @@ get_group_sizes (GtkCellArea *area, CellInfo *info = l->data; if (!gtk_cell_renderer_get_visible (info->renderer)) - continue; + continue; sizes[i].data = info; - + gtk_cell_area_request_renderer (area, info->renderer, - orientation, widget, -1, - &sizes[i].minimum_size, - &sizes[i].natural_size); + orientation, widget, -1, + &sizes[i].minimum_size, + &sizes[i].natural_size); i++; } @@ -1471,11 +1493,11 @@ get_group_sizes (GtkCellArea *area, static void compute_group_size_for_opposing_orientation (GtkCellAreaBox *box, - CellGroup *group, - GtkWidget *widget, - gint for_size, - gint *minimum_size, - gint *natural_size) + CellGroup *group, + GtkWidget *widget, + gint for_size, + gint *minimum_size, + gint *natural_size) { GtkCellAreaBoxPrivate *priv = box->priv; GtkCellArea *area = GTK_CELL_AREA (box); @@ -1486,8 +1508,8 @@ compute_group_size_for_opposing_orientation (GtkCellAreaBox *box, CellInfo *info = group->cells->data; gtk_cell_area_request_renderer (area, info->renderer, - OPPOSITE_ORIENTATION (priv->orientation), - widget, for_size, minimum_size, natural_size); + OPPOSITE_ORIENTATION (priv->orientation), + widget, for_size, minimum_size, natural_size); } else { @@ -1503,7 +1525,7 @@ compute_group_size_for_opposing_orientation (GtkCellAreaBox *box, /* First naturally allocate the cells in the group into the for_size */ avail_size -= (n_sizes - 1) * priv->spacing; for (i = 0; i < n_sizes; i++) - avail_size -= orientation_sizes[i].minimum_size; + avail_size -= orientation_sizes[i].minimum_size; if (avail_size > 0) avail_size = gtk_distribute_natural_allocation (avail_size, n_sizes, orientation_sizes); @@ -1512,38 +1534,38 @@ compute_group_size_for_opposing_orientation (GtkCellAreaBox *box, /* Calculate/distribute expand for cells */ if (group->expand_cells > 0) - { - extra_size = avail_size / group->expand_cells; - extra_extra = avail_size % group->expand_cells; - } + { + extra_size = avail_size / group->expand_cells; + extra_extra = avail_size % group->expand_cells; + } else - extra_size = extra_extra = 0; + extra_size = extra_extra = 0; for (i = 0; i < n_sizes; i++) - { - gint cell_min, cell_nat; - - info = orientation_sizes[i].data; - - if (info->expand) - { - orientation_sizes[i].minimum_size += extra_size; - if (extra_extra) - { - orientation_sizes[i].minimum_size++; - extra_extra--; - } - } - - gtk_cell_area_request_renderer (area, info->renderer, - OPPOSITE_ORIENTATION (priv->orientation), - widget, - orientation_sizes[i].minimum_size, - &cell_min, &cell_nat); - - min_size = MAX (min_size, cell_min); - nat_size = MAX (nat_size, cell_nat); - } + { + gint cell_min, cell_nat; + + info = orientation_sizes[i].data; + + if (info->expand) + { + orientation_sizes[i].minimum_size += extra_size; + if (extra_extra) + { + orientation_sizes[i].minimum_size++; + extra_extra--; + } + } + + gtk_cell_area_request_renderer (area, info->renderer, + OPPOSITE_ORIENTATION (priv->orientation), + widget, + orientation_sizes[i].minimum_size, + &cell_min, &cell_nat); + + min_size = MAX (min_size, cell_min); + nat_size = MAX (nat_size, cell_nat); + } *minimum_size = min_size; *natural_size = nat_size; @@ -1553,12 +1575,12 @@ compute_group_size_for_opposing_orientation (GtkCellAreaBox *box, } static void -compute_size_for_opposing_orientation (GtkCellAreaBox *box, - GtkCellAreaBoxContext *context, - GtkWidget *widget, - gint for_size, - gint *minimum_size, - gint *natural_size) +compute_size_for_opposing_orientation (GtkCellAreaBox *box, + GtkCellAreaBoxContext *context, + GtkWidget *widget, + gint for_size, + gint *minimum_size, + gint *natural_size) { GtkCellAreaBoxPrivate *priv = box->priv; CellGroup *group; @@ -1595,44 +1617,46 @@ compute_size_for_opposing_orientation (GtkCellAreaBox *box, extra_size = extra_extra = 0; /* Now we need to naturally allocate sizes for cells in each group - * and push the height-for-width for each group accordingly while accumulating - * the overall height-for-width for this row. + * and push the height-for-width for each group accordingly while + * accumulating the overall height-for-width for this row. */ for (i = 0; i < n_groups; i++) { gint group_min, group_nat; gint group_idx = GPOINTER_TO_INT (orientation_sizes[i].data); - + group = &g_array_index (priv->groups, CellGroup, group_idx); if (group->expand_cells > 0) - { - orientation_sizes[i].minimum_size += extra_size; - if (extra_extra) - { - orientation_sizes[i].minimum_size++; - extra_extra--; - } - } - - /* Now we have the allocation for the group, request it's height-for-width */ + { + orientation_sizes[i].minimum_size += extra_size; + if (extra_extra) + { + orientation_sizes[i].minimum_size++; + extra_extra--; + } + } + + /* Now we have the allocation for the group, + * request it's height-for-width + */ compute_group_size_for_opposing_orientation (box, group, widget, - orientation_sizes[i].minimum_size, - &group_min, &group_nat); + orientation_sizes[i].minimum_size, + &group_min, &group_nat); min_size = MAX (min_size, group_min); nat_size = MAX (nat_size, group_nat); if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) - { - gtk_cell_area_box_context_push_group_height_for_width (context, group_idx, for_size, - group_min, group_nat); - } + { + gtk_cell_area_box_context_push_group_height_for_width (context, group_idx, for_size, + group_min, group_nat); + } else - { - gtk_cell_area_box_context_push_group_width_for_height (context, group_idx, for_size, - group_min, group_nat); - } + { + gtk_cell_area_box_context_push_group_width_for_height (context, group_idx, for_size, + group_min, group_nat); + } } *minimum_size = min_size; @@ -1642,17 +1666,17 @@ compute_size_for_opposing_orientation (GtkCellAreaBox *box, /* Update rtl state for focus navigation to work */ priv->rtl = (priv->orientation == GTK_ORIENTATION_HORIZONTAL && - gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); + gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL); } static void gtk_cell_area_box_get_preferred_width (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint *minimum_width, - gint *natural_width) + GtkCellAreaContext *context, + GtkWidget *widget, + gint *minimum_width, + gint *natural_width) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxContext *box_context; @@ -1662,10 +1686,11 @@ gtk_cell_area_box_get_preferred_width (GtkCellArea *area, box_context = GTK_CELL_AREA_BOX_CONTEXT (context); - /* Compute the size of all renderers for current row data, - * bumping cell alignments in the context along the way */ + /* Compute the size of all renderers for current row data, + * bumping cell alignments in the context along the way + */ compute_size (box, GTK_ORIENTATION_HORIZONTAL, - box_context, widget, -1, &min_width, &nat_width); + box_context, widget, -1, &min_width, &nat_width); if (minimum_width) *minimum_width = min_width; @@ -1676,10 +1701,10 @@ gtk_cell_area_box_get_preferred_width (GtkCellArea *area, static void gtk_cell_area_box_get_preferred_height (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint *minimum_height, - gint *natural_height) + GtkCellAreaContext *context, + GtkWidget *widget, + gint *minimum_height, + gint *natural_height) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxContext *box_context; @@ -1689,10 +1714,11 @@ gtk_cell_area_box_get_preferred_height (GtkCellArea *area, box_context = GTK_CELL_AREA_BOX_CONTEXT (context); - /* Compute the size of all renderers for current row data, - * bumping cell alignments in the context along the way */ + /* Compute the size of all renderers for current row data, + * bumping cell alignments in the context along the way + */ compute_size (box, GTK_ORIENTATION_VERTICAL, - box_context, widget, -1, &min_height, &nat_height); + box_context, widget, -1, &min_height, &nat_height); if (minimum_height) *minimum_height = min_height; @@ -1703,11 +1729,11 @@ gtk_cell_area_box_get_preferred_height (GtkCellArea *area, static void gtk_cell_area_box_get_preferred_height_for_width (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint width, - gint *minimum_height, - gint *natural_height) + GtkCellAreaContext *context, + GtkWidget *widget, + gint width, + gint *minimum_height, + gint *natural_height) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxContext *box_context; @@ -1721,14 +1747,17 @@ gtk_cell_area_box_get_preferred_height_for_width (GtkCellArea *area, if (priv->orientation == GTK_ORIENTATION_VERTICAL) { - /* Add up vertical requests of height for width and push the overall - * cached sizes for alignments */ + /* Add up vertical requests of height for width and push + * the overall cached sizes for alignments + */ compute_size (box, priv->orientation, box_context, widget, width, &min_height, &nat_height); } else { - /* Juice: virtually allocate cells into the for_width using the - * alignments and then return the overall height for that width, and cache it */ + /* Juice: virtually allocate cells into the for_width using the + * alignments and then return the overall height for that width, + * and cache it + */ compute_size_for_opposing_orientation (box, box_context, widget, width, &min_height, &nat_height); } @@ -1741,11 +1770,11 @@ gtk_cell_area_box_get_preferred_height_for_width (GtkCellArea *area, static void gtk_cell_area_box_get_preferred_width_for_height (GtkCellArea *area, - GtkCellAreaContext *context, - GtkWidget *widget, - gint height, - gint *minimum_width, - gint *natural_width) + GtkCellAreaContext *context, + GtkWidget *widget, + gint height, + gint *minimum_width, + gint *natural_width) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxContext *box_context; @@ -1759,14 +1788,17 @@ gtk_cell_area_box_get_preferred_width_for_height (GtkCellArea *area, if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) { - /* Add up horizontal requests of width for height and push the overall - * cached sizes for alignments */ + /* Add up horizontal requests of width for height and push + * the overall cached sizes for alignments + */ compute_size (box, priv->orientation, box_context, widget, height, &min_width, &nat_width); } else { - /* Juice: horizontally allocate cells into the for_height using the - * alignments and then return the overall width for that height, and cache it */ + /* Juice: horizontally allocate cells into the for_height using the + * alignments and then return the overall width for that height, + * and cache it + */ compute_size_for_opposing_orientation (box, box_context, widget, height, &min_width, &nat_width); } @@ -1786,7 +1818,7 @@ enum { static gboolean gtk_cell_area_box_focus (GtkCellArea *area, - GtkDirectionType direction) + GtkDirectionType direction) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (area); GtkCellAreaBoxPrivate *priv = box->priv; @@ -1814,29 +1846,29 @@ gtk_cell_area_box_focus (GtkCellArea *area, case GTK_DIR_TAB_BACKWARD: cycle = priv->rtl ? FOCUS_NEXT : FOCUS_PREV; break; - case GTK_DIR_UP: + case GTK_DIR_UP: if (priv->orientation == GTK_ORIENTATION_VERTICAL || !priv->last_focus_cell) - cycle = FOCUS_PREV; + cycle = FOCUS_PREV; else if (!focus_cell) - cycle = FOCUS_LAST_CELL; + cycle = FOCUS_LAST_CELL; break; case GTK_DIR_DOWN: if (priv->orientation == GTK_ORIENTATION_VERTICAL || !priv->last_focus_cell) - cycle = FOCUS_NEXT; + cycle = FOCUS_NEXT; else if (!focus_cell) - cycle = FOCUS_LAST_CELL; + cycle = FOCUS_LAST_CELL; break; case GTK_DIR_LEFT: if (priv->orientation == GTK_ORIENTATION_HORIZONTAL || !priv->last_focus_cell) - cycle = priv->rtl ? FOCUS_NEXT : FOCUS_PREV; + cycle = priv->rtl ? FOCUS_NEXT : FOCUS_PREV; else if (!focus_cell) - cycle = FOCUS_LAST_CELL; + cycle = FOCUS_LAST_CELL; break; case GTK_DIR_RIGHT: if (priv->orientation == GTK_ORIENTATION_HORIZONTAL || !priv->last_focus_cell) - cycle = priv->rtl ? FOCUS_PREV : FOCUS_NEXT; + cycle = priv->rtl ? FOCUS_PREV : FOCUS_NEXT; else if (!focus_cell) - cycle = FOCUS_LAST_CELL; + cycle = FOCUS_LAST_CELL; break; default: break; @@ -1853,31 +1885,31 @@ gtk_cell_area_box_focus (GtkCellArea *area, GList *list; gint i; - /* If there is no focused cell, focus on the first (or last) one in the list */ + /* If there is no focused cell, focus on the first (or last) one */ if (!focus_cell) - found_cell = TRUE; - - for (i = (cycle == FOCUS_NEXT) ? 0 : priv->groups->len -1; - cycled_focus == FALSE && i >= 0 && i < priv->groups->len; - i = (cycle == FOCUS_NEXT) ? i + 1 : i - 1) - { - CellGroup *group = &g_array_index (priv->groups, CellGroup, i); - - for (list = (cycle == FOCUS_NEXT) ? g_list_first (group->cells) : g_list_last (group->cells); - cycled_focus == FALSE && list; list = (cycle == FOCUS_NEXT) ? list->next : list->prev) - { - CellInfo *info = list->data; - - if (info->renderer == focus_cell) - found_cell = TRUE; - else if (found_cell && /* Dont give focus to cells that are siblings to a focus cell */ - gtk_cell_area_get_focus_from_sibling (area, info->renderer) == NULL) - { + found_cell = TRUE; + + for (i = (cycle == FOCUS_NEXT) ? 0 : priv->groups->len -1; + cycled_focus == FALSE && i >= 0 && i < priv->groups->len; + i = (cycle == FOCUS_NEXT) ? i + 1 : i - 1) + { + CellGroup *group = &g_array_index (priv->groups, CellGroup, i); + + for (list = (cycle == FOCUS_NEXT) ? g_list_first (group->cells) : g_list_last (group->cells); + cycled_focus == FALSE && list; list = (cycle == FOCUS_NEXT) ? list->next : list->prev) + { + CellInfo *info = list->data; + + if (info->renderer == focus_cell) + found_cell = TRUE; + else if (found_cell && /* Dont give focus to cells that are siblings to a focus cell */ + gtk_cell_area_get_focus_from_sibling (area, info->renderer) == NULL) + { gtk_cell_area_set_focus_cell (area, info->renderer); cycled_focus = TRUE; - } - } - } + } + } + } } if (!cycled_focus) @@ -1900,32 +1932,32 @@ gtk_cell_area_box_cell_layout_init (GtkCellLayoutIface *iface) static void gtk_cell_area_box_layout_pack_start (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer, - gboolean expand) + GtkCellRenderer *renderer, + gboolean expand) { gtk_cell_area_box_pack_start (GTK_CELL_AREA_BOX (cell_layout), renderer, expand, TRUE); } static void gtk_cell_area_box_layout_pack_end (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer, - gboolean expand) + GtkCellRenderer *renderer, + gboolean expand) { gtk_cell_area_box_pack_end (GTK_CELL_AREA_BOX (cell_layout), renderer, expand, TRUE); } static void gtk_cell_area_box_layout_reorder (GtkCellLayout *cell_layout, - GtkCellRenderer *renderer, - gint position) + GtkCellRenderer *renderer, + gint position) { GtkCellAreaBox *box = GTK_CELL_AREA_BOX (cell_layout); GtkCellAreaBoxPrivate *priv = box->priv; GList *node; CellInfo *info; - - node = g_list_find_custom (priv->cells, renderer, - (GCompareFunc)cell_info_find); + + node = g_list_find_custom (priv->cells, renderer, + (GCompareFunc)cell_info_find); if (node) { @@ -1943,10 +1975,12 @@ gtk_cell_area_box_layout_reorder (GtkCellLayout *cell_layout, *************************************************************/ /** * gtk_cell_area_box_new: - * + * * Creates a new #GtkCellAreaBox. * * Return value: a newly created #GtkCellAreaBox + * + * Since: 3.0 */ GtkCellArea * gtk_cell_area_box_new (void) @@ -1960,20 +1994,20 @@ gtk_cell_area_box_new (void) * @renderer: the #GtkCellRenderer to add * @expand: whether @renderer should receive extra space when the area receives * more than its natural size - * @align: whether @renderer should be aligned in adjacent rows. + * @align: whether @renderer should be aligned in adjacent rows * * Adds @renderer to @box, packed with reference to the start of @box. * - * The @renderer is packed after any other #GtkCellRenderer packed with reference - * to the start of @box. + * The @renderer is packed after any other #GtkCellRenderer packed + * with reference to the start of @box. * * Since: 3.0 */ void gtk_cell_area_box_pack_start (GtkCellAreaBox *box, - GtkCellRenderer *renderer, - gboolean expand, - gboolean align) + GtkCellRenderer *renderer, + gboolean expand, + gboolean align) { GtkCellAreaBoxPrivate *priv; CellInfo *info; @@ -1983,8 +2017,8 @@ gtk_cell_area_box_pack_start (GtkCellAreaBox *box, priv = box->priv; - if (g_list_find_custom (priv->cells, renderer, - (GCompareFunc)cell_info_find)) + if (g_list_find_custom (priv->cells, renderer, + (GCompareFunc)cell_info_find)) { g_warning ("Refusing to add the same cell renderer to a GtkCellAreaBox twice"); return; @@ -2003,20 +2037,20 @@ gtk_cell_area_box_pack_start (GtkCellAreaBox *box, * @renderer: the #GtkCellRenderer to add * @expand: whether @renderer should receive extra space when the area receives * more than its natural size - * @align: whether @renderer should be aligned in adjacent rows. + * @align: whether @renderer should be aligned in adjacent rows * * Adds @renderer to @box, packed with reference to the end of @box. * - * The @renderer is packed after (away from end of) any other #GtkCellRenderer - * packed with reference to the end of @box. + * The @renderer is packed after (away from end of) any other + * #GtkCellRenderer packed with reference to the end of @box. * * Since: 3.0 */ void gtk_cell_area_box_pack_end (GtkCellAreaBox *box, - GtkCellRenderer *renderer, - gboolean expand, - gboolean align) + GtkCellRenderer *renderer, + gboolean expand, + gboolean align) { GtkCellAreaBoxPrivate *priv; CellInfo *info; @@ -2026,8 +2060,8 @@ gtk_cell_area_box_pack_end (GtkCellAreaBox *box, priv = box->priv; - if (g_list_find_custom (priv->cells, renderer, - (GCompareFunc)cell_info_find)) + if (g_list_find_custom (priv->cells, renderer, + (GCompareFunc)cell_info_find)) { g_warning ("Refusing to add the same cell renderer to a GtkCellArea twice"); return; @@ -2069,7 +2103,7 @@ gtk_cell_area_box_get_spacing (GtkCellAreaBox *box) */ void gtk_cell_area_box_set_spacing (GtkCellAreaBox *box, - gint spacing) + gint spacing) { GtkCellAreaBoxPrivate *priv; diff --git a/gtk/gtkcellareabox.h b/gtk/gtkcellareabox.h index a6d3a061bb..632ea93bec 100644 --- a/gtk/gtkcellareabox.h +++ b/gtk/gtkcellareabox.h @@ -32,10 +32,10 @@ G_BEGIN_DECLS -#define GTK_TYPE_CELL_AREA_BOX (gtk_cell_area_box_get_type ()) -#define GTK_CELL_AREA_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA_BOX, GtkCellAreaBox)) -#define GTK_CELL_AREA_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA_BOX, GtkCellAreaBoxClass)) -#define GTK_IS_CELL_AREA_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA_BOX)) +#define GTK_TYPE_CELL_AREA_BOX (gtk_cell_area_box_get_type ()) +#define GTK_CELL_AREA_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA_BOX, GtkCellAreaBox)) +#define GTK_CELL_AREA_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA_BOX, GtkCellAreaBoxClass)) +#define GTK_IS_CELL_AREA_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA_BOX)) #define GTK_IS_CELL_AREA_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA_BOX)) #define GTK_CELL_AREA_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA_BOX, GtkCellAreaBoxClass)) @@ -63,20 +63,20 @@ struct _GtkCellAreaBoxClass void (*_gtk_reserved4) (void); }; -GType gtk_cell_area_box_get_type (void) G_GNUC_CONST; +GType gtk_cell_area_box_get_type (void) G_GNUC_CONST; -GtkCellArea *gtk_cell_area_box_new (void); -void gtk_cell_area_box_pack_start (GtkCellAreaBox *box, - GtkCellRenderer *renderer, - gboolean expand, - gboolean align); -void gtk_cell_area_box_pack_end (GtkCellAreaBox *box, - GtkCellRenderer *renderer, - gboolean expand, - gboolean align); -gint gtk_cell_area_box_get_spacing (GtkCellAreaBox *box); -void gtk_cell_area_box_set_spacing (GtkCellAreaBox *box, - gint spacing); +GtkCellArea *gtk_cell_area_box_new (void); +void gtk_cell_area_box_pack_start (GtkCellAreaBox *box, + GtkCellRenderer *renderer, + gboolean expand, + gboolean align); +void gtk_cell_area_box_pack_end (GtkCellAreaBox *box, + GtkCellRenderer *renderer, + gboolean expand, + gboolean align); +gint gtk_cell_area_box_get_spacing (GtkCellAreaBox *box); +void gtk_cell_area_box_set_spacing (GtkCellAreaBox *box, + gint spacing); G_END_DECLS diff --git a/gtk/gtkcellareaboxcontext.c b/gtk/gtkcellareaboxcontext.c index 2c0fa22ac7..b68002d9c5 100644 --- a/gtk/gtkcellareaboxcontext.c +++ b/gtk/gtkcellareaboxcontext.c @@ -33,32 +33,32 @@ static void gtk_cell_area_box_context_finalize (GObject /* GtkCellAreaContextClass */ static void gtk_cell_area_box_context_reset (GtkCellAreaContext *context); static void gtk_cell_area_box_context_allocate (GtkCellAreaContext *context, - gint width, - gint height); + gint width, + gint height); static void gtk_cell_area_box_context_get_preferred_height_for_width (GtkCellAreaContext *context, - gint width, - gint *minimum_height, - gint *natural_height); + gint width, + gint *minimum_height, + gint *natural_height); static void gtk_cell_area_box_context_get_preferred_width_for_height (GtkCellAreaContext *context, - gint height, - gint *minimum_width, - gint *natural_width); + gint height, + gint *minimum_width, + gint *natural_width); /* Internal functions */ static void gtk_cell_area_box_context_sum (GtkCellAreaBoxContext *context, - GtkOrientation orientation, - gint for_size, - gint *minimum_size, - gint *natural_size); + GtkOrientation orientation, + gint for_size, + gint *minimum_size, + gint *natural_size); static void free_cache_array (GArray *array); static GArray *group_array_new (GtkCellAreaBoxContext *context); static GArray *get_array (GtkCellAreaBoxContext *context, - GtkOrientation orientation, - gint for_size); + GtkOrientation orientation, + gint for_size); static gboolean group_expands (GtkCellAreaBoxContext *context, - gint group_idx); + gint group_idx); static gint count_expand_groups (GtkCellAreaBoxContext *context); @@ -110,8 +110,8 @@ group_array_new (GtkCellAreaBoxContext *context) static GArray * get_array (GtkCellAreaBoxContext *context, - GtkOrientation orientation, - gint for_size) + GtkOrientation orientation, + gint for_size) { GtkCellAreaBoxContextPrivate *priv = context->priv; GArray *array; @@ -119,26 +119,26 @@ get_array (GtkCellAreaBoxContext *context, if (for_size < 0) { if (orientation == GTK_ORIENTATION_HORIZONTAL) - array = priv->base_widths; + array = priv->base_widths; else - array = priv->base_heights; + array = priv->base_heights; } else { if (orientation == GTK_ORIENTATION_HORIZONTAL) - { - array = g_hash_table_lookup (priv->widths, GINT_TO_POINTER (for_size)); + { + array = g_hash_table_lookup (priv->widths, GINT_TO_POINTER (for_size)); - if (!array) - array = priv->base_widths; - } + if (!array) + array = priv->base_widths; + } else - { - array = g_hash_table_lookup (priv->heights, GINT_TO_POINTER (for_size)); + { + array = g_hash_table_lookup (priv->heights, GINT_TO_POINTER (for_size)); - if (!array) - array = priv->base_heights; - } + if (!array) + array = priv->base_heights; + } } return array; @@ -146,7 +146,7 @@ get_array (GtkCellAreaBoxContext *context, static gboolean group_expands (GtkCellAreaBoxContext *context, - gint group_idx) + gint group_idx) { GtkCellAreaBoxContextPrivate *priv = context->priv; @@ -164,7 +164,7 @@ count_expand_groups (GtkCellAreaBoxContext *context) for (i = 0; i < priv->base_widths->len; i++) { if (priv->expand[i]) - expand++; + expand++; } return expand; @@ -176,17 +176,17 @@ gtk_cell_area_box_context_init (GtkCellAreaBoxContext *box_context) GtkCellAreaBoxContextPrivate *priv; box_context->priv = G_TYPE_INSTANCE_GET_PRIVATE (box_context, - GTK_TYPE_CELL_AREA_BOX_CONTEXT, - GtkCellAreaBoxContextPrivate); + GTK_TYPE_CELL_AREA_BOX_CONTEXT, + GtkCellAreaBoxContextPrivate); priv = box_context->priv; priv->base_widths = g_array_new (FALSE, TRUE, sizeof (CachedSize)); priv->base_heights = g_array_new (FALSE, TRUE, sizeof (CachedSize)); priv->widths = g_hash_table_new_full (g_direct_hash, g_direct_equal, - NULL, (GDestroyNotify)free_cache_array); + NULL, (GDestroyNotify)free_cache_array); priv->heights = g_hash_table_new_full (g_direct_hash, g_direct_equal, - NULL, (GDestroyNotify)free_cache_array); + NULL, (GDestroyNotify)free_cache_array); priv->alloc_width = 0; priv->alloc_height = 0; @@ -232,7 +232,7 @@ gtk_cell_area_box_context_finalize (GObject *object) } /************************************************************* - * GtkCellAreaContextClass * + * GtkCellAreaContextClass * *************************************************************/ static void gtk_cell_area_box_context_reset (GtkCellAreaContext *context) @@ -270,9 +270,9 @@ gtk_cell_area_box_context_reset (GtkCellAreaContext *context) static GtkRequestedSize * gtk_cell_area_box_context_get_requests (GtkCellAreaBoxContext *box_context, - GtkOrientation orientation, - gint for_size, - gint *n_requests) + GtkOrientation orientation, + gint for_size, + gint *n_requests) { GtkCellAreaBoxContextPrivate *priv; GtkRequestedSize *requests; @@ -291,7 +291,7 @@ gtk_cell_area_box_context_get_requests (GtkCellAreaBoxContext *box_context, size = &g_array_index (array, CachedSize, i); if (size->nat_size > 0) - visible_groups++; + visible_groups++; } requests = g_new (GtkRequestedSize, visible_groups); @@ -301,12 +301,12 @@ gtk_cell_area_box_context_get_requests (GtkCellAreaBoxContext *box_context, size = &g_array_index (array, CachedSize, i); if (size->nat_size > 0) - { - requests[j].data = GINT_TO_POINTER (i); - requests[j].minimum_size = size->min_size; - requests[j].natural_size = size->nat_size; - j++; - } + { + requests[j].data = GINT_TO_POINTER (i); + requests[j].minimum_size = size->min_size; + requests[j].natural_size = size->nat_size; + j++; + } } if (n_requests) @@ -317,11 +317,11 @@ gtk_cell_area_box_context_get_requests (GtkCellAreaBoxContext *box_context, static GtkCellAreaBoxAllocation * allocate_for_orientation (GtkCellAreaBoxContext *context, - GtkOrientation orientation, - gint spacing, - gint size, - gint for_size, - gint *n_allocs) + GtkOrientation orientation, + gint spacing, + gint size, + gint for_size, + gint *n_allocs) { GtkCellAreaBoxAllocation *allocs; GtkRequestedSize *sizes; @@ -363,14 +363,14 @@ allocate_for_orientation (GtkCellAreaBoxContext *context, allocs[i].size = sizes[i].minimum_size; if (group_expands (context, allocs[i].group_idx)) - { - allocs[i].size += extra_size; - if (extra_extra) - { - allocs[i].size++; - extra_extra--; - } - } + { + allocs[i].size += extra_size; + if (extra_extra) + { + allocs[i].size++; + extra_extra--; + } + } position += allocs[i].size; position += spacing; @@ -386,8 +386,8 @@ allocate_for_orientation (GtkCellAreaBoxContext *context, static void gtk_cell_area_box_context_allocate (GtkCellAreaContext *context, - gint width, - gint height) + gint width, + gint height) { GtkCellAreaBoxContext *box_context = GTK_CELL_AREA_BOX_CONTEXT (context); GtkCellAreaBoxContextPrivate *priv = box_context->priv; @@ -405,22 +405,22 @@ gtk_cell_area_box_context_allocate (GtkCellAreaContext *context, if (orientation == GTK_ORIENTATION_HORIZONTAL && width > 0) priv->orientation_allocs = allocate_for_orientation (box_context, orientation, - spacing, width, height, - &priv->n_orientation_allocs); + spacing, width, height, + &priv->n_orientation_allocs); else if (orientation == GTK_ORIENTATION_VERTICAL && height > 0) priv->orientation_allocs = allocate_for_orientation (box_context, orientation, - spacing, height, width, - &priv->n_orientation_allocs); + spacing, height, width, + &priv->n_orientation_allocs); GTK_CELL_AREA_CONTEXT_CLASS (gtk_cell_area_box_context_parent_class)->allocate (context, width, height); } static void gtk_cell_area_box_context_sum (GtkCellAreaBoxContext *context, - GtkOrientation orientation, - gint for_size, - gint *minimum_size, - gint *natural_size) + GtkOrientation orientation, + gint for_size, + gint *minimum_size, + gint *natural_size) { GtkCellArea *area; GtkOrientation box_orientation; @@ -438,32 +438,32 @@ gtk_cell_area_box_context_sum (GtkCellAreaBoxContext *context, CachedSize *size = &g_array_index (array, CachedSize, i); if (box_orientation == orientation) - { - /* Dont add spacing for 0 size groups, they can be 0 size because - * they contain only invisible cells for this round of requests - */ - if (min_size > 0 && size->nat_size > 0) - { - min_size += spacing; - nat_size += spacing; - } - - min_size += size->min_size; - nat_size += size->nat_size; - } + { + /* Dont add spacing for 0 size groups, they can be 0 size because + * they contain only invisible cells for this round of requests + */ + if (min_size > 0 && size->nat_size > 0) + { + min_size += spacing; + nat_size += spacing; + } + + min_size += size->min_size; + nat_size += size->nat_size; + } else - { - min_size = MAX (min_size, size->min_size); - nat_size = MAX (nat_size, size->nat_size); - } + { + min_size = MAX (min_size, size->min_size); + nat_size = MAX (nat_size, size->nat_size); + } } if (for_size < 0) { if (orientation == GTK_ORIENTATION_HORIZONTAL) - gtk_cell_area_context_push_preferred_width (GTK_CELL_AREA_CONTEXT (context), min_size, nat_size); + gtk_cell_area_context_push_preferred_width (GTK_CELL_AREA_CONTEXT (context), min_size, nat_size); else - gtk_cell_area_context_push_preferred_height (GTK_CELL_AREA_CONTEXT (context), min_size, nat_size); + gtk_cell_area_context_push_preferred_height (GTK_CELL_AREA_CONTEXT (context), min_size, nat_size); } if (minimum_size) @@ -474,22 +474,22 @@ gtk_cell_area_box_context_sum (GtkCellAreaBoxContext *context, static void gtk_cell_area_box_context_get_preferred_height_for_width (GtkCellAreaContext *context, - gint width, - gint *minimum_height, - gint *natural_height) + gint width, + gint *minimum_height, + gint *natural_height) { gtk_cell_area_box_context_sum (GTK_CELL_AREA_BOX_CONTEXT (context), GTK_ORIENTATION_VERTICAL, - width, minimum_height, natural_height); + width, minimum_height, natural_height); } static void gtk_cell_area_box_context_get_preferred_width_for_height (GtkCellAreaContext *context, - gint height, - gint *minimum_width, - gint *natural_width) + gint height, + gint *minimum_width, + gint *natural_width) { gtk_cell_area_box_context_sum (GTK_CELL_AREA_BOX_CONTEXT (context), GTK_ORIENTATION_HORIZONTAL, - height, minimum_width, natural_width); + height, minimum_width, natural_width); } /************************************************************* @@ -497,7 +497,7 @@ gtk_cell_area_box_context_get_preferred_width_for_height (GtkCellAreaContext *co *************************************************************/ static void copy_size_array (GArray *src_array, - GArray *dest_array) + GArray *dest_array) { gint i; @@ -512,8 +512,8 @@ copy_size_array (GArray *src_array, static void for_size_copy (gpointer key, - GArray *size_array, - GHashTable *dest_hash) + GArray *size_array, + GHashTable *dest_hash) { GArray *new_array; @@ -527,52 +527,52 @@ for_size_copy (gpointer key, GtkCellAreaBoxContext * gtk_cell_area_box_context_copy (GtkCellAreaBox *box, - GtkCellAreaBoxContext *context) + GtkCellAreaBoxContext *context) { GtkCellAreaBoxContext *copy; - copy = g_object_new (GTK_TYPE_CELL_AREA_BOX_CONTEXT, - "area", box, NULL); + copy = g_object_new (GTK_TYPE_CELL_AREA_BOX_CONTEXT, + "area", box, NULL); - gtk_cell_area_box_init_groups (copy, - context->priv->base_widths->len, - context->priv->expand); + gtk_cell_area_box_init_groups (copy, + context->priv->base_widths->len, + context->priv->expand); /* Copy the base arrays */ - copy_size_array (context->priv->base_widths, - copy->priv->base_widths); - copy_size_array (context->priv->base_heights, - copy->priv->base_heights); + copy_size_array (context->priv->base_widths, + copy->priv->base_widths); + copy_size_array (context->priv->base_heights, + copy->priv->base_heights); /* Copy each for size */ g_hash_table_foreach (context->priv->heights, - (GHFunc)for_size_copy, copy->priv->heights); + (GHFunc)for_size_copy, copy->priv->heights); g_hash_table_foreach (context->priv->widths, - (GHFunc)for_size_copy, copy->priv->widths); + (GHFunc)for_size_copy, copy->priv->widths); /* Copy any active allocation */ - copy->priv->n_orientation_allocs = + copy->priv->n_orientation_allocs = context->priv->n_orientation_allocs; if (copy->priv->n_orientation_allocs) - copy->priv->orientation_allocs = - g_memdup (context->priv->orientation_allocs, - copy->priv->n_orientation_allocs * sizeof (GtkCellAreaBoxAllocation)); + copy->priv->orientation_allocs = + g_memdup (context->priv->orientation_allocs, + copy->priv->n_orientation_allocs * sizeof (GtkCellAreaBoxAllocation)); return copy; } void gtk_cell_area_box_init_groups (GtkCellAreaBoxContext *box_context, - guint n_groups, - gboolean *expand_groups) + guint n_groups, + gboolean *expand_groups) { GtkCellAreaBoxContextPrivate *priv; g_return_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (box_context)); g_return_if_fail (n_groups == 0 || expand_groups != NULL); - /* When the group dimensions change, all info must be reset + /* When the group dimensions change, all info must be reset * Note this already clears the min/nat values on the CachedSizes */ gtk_cell_area_context_reset (GTK_CELL_AREA_CONTEXT (box_context)); @@ -587,9 +587,9 @@ gtk_cell_area_box_init_groups (GtkCellAreaBoxContext *box_context, void gtk_cell_area_box_context_push_group_width (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint minimum_width, - gint natural_width) + gint group_idx, + gint minimum_width, + gint natural_width) { GtkCellAreaBoxContextPrivate *priv; CachedSize *size; @@ -618,10 +618,10 @@ gtk_cell_area_box_context_push_group_width (GtkCellAreaBoxContext *box_context, void gtk_cell_area_box_context_push_group_height_for_width (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint for_width, - gint minimum_height, - gint natural_height) + gint group_idx, + gint for_width, + gint minimum_height, + gint natural_height) { GtkCellAreaBoxContextPrivate *priv; GArray *group_array; @@ -646,9 +646,9 @@ gtk_cell_area_box_context_push_group_height_for_width (GtkCellAreaBoxContext *b void gtk_cell_area_box_context_push_group_height (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint minimum_height, - gint natural_height) + gint group_idx, + gint minimum_height, + gint natural_height) { GtkCellAreaBoxContextPrivate *priv; CachedSize *size; @@ -677,10 +677,10 @@ gtk_cell_area_box_context_push_group_height (GtkCellAreaBoxContext *box_context, void gtk_cell_area_box_context_push_group_width_for_height (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint for_height, - gint minimum_width, - gint natural_width) + gint group_idx, + gint for_height, + gint minimum_width, + gint natural_width) { GtkCellAreaBoxContextPrivate *priv; GArray *group_array; @@ -705,9 +705,9 @@ gtk_cell_area_box_context_push_group_width_for_height (GtkCellAreaBoxContext *bo void gtk_cell_area_box_context_get_group_width (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint *minimum_width, - gint *natural_width) + gint group_idx, + gint *minimum_width, + gint *natural_width) { GtkCellAreaBoxContextPrivate *priv; CachedSize *size; @@ -721,17 +721,17 @@ gtk_cell_area_box_context_get_group_width (GtkCellAreaBoxContext *box_context, if (minimum_width) *minimum_width = size->min_size; - + if (natural_width) *natural_width = size->nat_size; } void gtk_cell_area_box_context_get_group_height_for_width (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint for_width, - gint *minimum_height, - gint *natural_height) + gint group_idx, + gint for_width, + gint *minimum_height, + gint *natural_height) { GtkCellAreaBoxContextPrivate *priv; GArray *group_array; @@ -748,26 +748,26 @@ gtk_cell_area_box_context_get_group_height_for_width (GtkCellAreaBoxContext *box CachedSize *size = &g_array_index (group_array, CachedSize, group_idx); if (minimum_height) - *minimum_height = size->min_size; + *minimum_height = size->min_size; if (natural_height) - *natural_height = size->nat_size; + *natural_height = size->nat_size; } else { if (minimum_height) - *minimum_height = -1; + *minimum_height = -1; if (natural_height) - *natural_height = -1; + *natural_height = -1; } } void gtk_cell_area_box_context_get_group_height (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint *minimum_height, - gint *natural_height) + gint group_idx, + gint *minimum_height, + gint *natural_height) { GtkCellAreaBoxContextPrivate *priv; CachedSize *size; @@ -781,17 +781,17 @@ gtk_cell_area_box_context_get_group_height (GtkCellAreaBoxContext *box_context, if (minimum_height) *minimum_height = size->min_size; - + if (natural_height) *natural_height = size->nat_size; } void gtk_cell_area_box_context_get_group_width_for_height (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint for_height, - gint *minimum_width, - gint *natural_width) + gint group_idx, + gint for_height, + gint *minimum_width, + gint *natural_width) { GtkCellAreaBoxContextPrivate *priv; GArray *group_array; @@ -808,43 +808,43 @@ gtk_cell_area_box_context_get_group_width_for_height (GtkCellAreaBoxContext *box CachedSize *size = &g_array_index (group_array, CachedSize, group_idx); if (minimum_width) - *minimum_width = size->min_size; + *minimum_width = size->min_size; if (natural_width) - *natural_width = size->nat_size; + *natural_width = size->nat_size; } else { if (minimum_width) - *minimum_width = -1; + *minimum_width = -1; if (natural_width) - *natural_width = -1; + *natural_width = -1; } } GtkRequestedSize * gtk_cell_area_box_context_get_widths (GtkCellAreaBoxContext *box_context, - gint *n_widths) + gint *n_widths) { return gtk_cell_area_box_context_get_requests (box_context, GTK_ORIENTATION_HORIZONTAL, -1, n_widths); } GtkRequestedSize * gtk_cell_area_box_context_get_heights (GtkCellAreaBoxContext *box_context, - gint *n_heights) + gint *n_heights) { return gtk_cell_area_box_context_get_requests (box_context, GTK_ORIENTATION_VERTICAL, -1, n_heights); } GtkCellAreaBoxAllocation * gtk_cell_area_box_context_get_orientation_allocs (GtkCellAreaBoxContext *context, - gint *n_allocs) + gint *n_allocs) { GtkCellAreaBoxContextPrivate *priv; g_return_val_if_fail (GTK_IS_CELL_AREA_BOX_CONTEXT (context), NULL); - + priv = context->priv; *n_allocs = priv->n_orientation_allocs; diff --git a/gtk/gtkcellareaboxcontext.h b/gtk/gtkcellareaboxcontext.h index 1161d38b2f..7d9f37ed83 100644 --- a/gtk/gtkcellareaboxcontext.h +++ b/gtk/gtkcellareaboxcontext.h @@ -35,10 +35,10 @@ G_BEGIN_DECLS -#define GTK_TYPE_CELL_AREA_BOX_CONTEXT (gtk_cell_area_box_context_get_type ()) -#define GTK_CELL_AREA_BOX_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA_BOX_CONTEXT, GtkCellAreaBoxContext)) -#define GTK_CELL_AREA_BOX_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA_BOX_CONTEXT, GtkCellAreaBoxContextClass)) -#define GTK_IS_CELL_AREA_BOX_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA_BOX_CONTEXT)) +#define GTK_TYPE_CELL_AREA_BOX_CONTEXT (gtk_cell_area_box_context_get_type ()) +#define GTK_CELL_AREA_BOX_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA_BOX_CONTEXT, GtkCellAreaBoxContext)) +#define GTK_CELL_AREA_BOX_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA_BOX_CONTEXT, GtkCellAreaBoxContextClass)) +#define GTK_IS_CELL_AREA_BOX_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA_BOX_CONTEXT)) #define GTK_IS_CELL_AREA_BOX_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA_BOX_CONTEXT)) #define GTK_CELL_AREA_BOX_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA_BOX_CONTEXT, GtkCellAreaBoxContextClass)) @@ -64,63 +64,63 @@ GType gtk_cell_area_box_context_get_type (void) G_GNUC_CON /* Create a duplicate of the context */ GtkCellAreaBoxContext *gtk_cell_area_box_context_copy (GtkCellAreaBox *box, - GtkCellAreaBoxContext *box_context); + GtkCellAreaBoxContext *box_context); /* Initialize group array dimensions */ void gtk_cell_area_box_init_groups (GtkCellAreaBoxContext *box_context, - guint n_groups, - gboolean *expand_groups); + guint n_groups, + gboolean *expand_groups); /* Update cell-group sizes */ void gtk_cell_area_box_context_push_group_width (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint minimum_width, - gint natural_width); + gint group_idx, + gint minimum_width, + gint natural_width); void gtk_cell_area_box_context_push_group_height_for_width (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint for_width, - gint minimum_height, - gint natural_height); + gint group_idx, + gint for_width, + gint minimum_height, + gint natural_height); void gtk_cell_area_box_context_push_group_height (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint minimum_height, - gint natural_height); + gint group_idx, + gint minimum_height, + gint natural_height); void gtk_cell_area_box_context_push_group_width_for_height (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint for_height, - gint minimum_width, - gint natural_width); + gint group_idx, + gint for_height, + gint minimum_width, + gint natural_width); /* Fetch cell-group sizes */ void gtk_cell_area_box_context_get_group_width (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint *minimum_width, - gint *natural_width); + gint group_idx, + gint *minimum_width, + gint *natural_width); void gtk_cell_area_box_context_get_group_height_for_width (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint for_width, - gint *minimum_height, - gint *natural_height); + gint group_idx, + gint for_width, + gint *minimum_height, + gint *natural_height); void gtk_cell_area_box_context_get_group_height (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint *minimum_height, - gint *natural_height); + gint group_idx, + gint *minimum_height, + gint *natural_height); void gtk_cell_area_box_context_get_group_width_for_height (GtkCellAreaBoxContext *box_context, - gint group_idx, - gint for_height, - gint *minimum_width, - gint *natural_width); + gint group_idx, + gint for_height, + gint *minimum_width, + gint *natural_width); GtkRequestedSize *gtk_cell_area_box_context_get_widths (GtkCellAreaBoxContext *box_context, - gint *n_widths); + gint *n_widths); GtkRequestedSize *gtk_cell_area_box_context_get_heights (GtkCellAreaBoxContext *box_context, - gint *n_heights); + gint *n_heights); /* Private context/area interaction */ typedef struct { @@ -131,7 +131,7 @@ typedef struct { GtkCellAreaBoxAllocation * gtk_cell_area_box_context_get_orientation_allocs (GtkCellAreaBoxContext *context, - gint *n_allocs); + gint *n_allocs); G_END_DECLS diff --git a/gtk/gtkcellareacontext.c b/gtk/gtkcellareacontext.c index 44c718aa1c..d2249d9219 100644 --- a/gtk/gtkcellareacontext.c +++ b/gtk/gtkcellareacontext.c @@ -23,18 +23,22 @@ /** * SECTION:gtkcellareacontext - * @Short_Description: An object for a GtkCellArea to store geometrical information for a series of rows. + * @Short_Description: An object for a GtkCellArea to store geometrical + * information for a series of rows. * @Title: GtkCellAreaContext * - * The #GtkCellAreaContext object is created by a given #GtkCellArea implementation via it's - * #GtkCellAreaClass.create_context() virtual method and is used to store cell sizes and alignments - * for a series of #GtkTreeModel rows that are requested and rendered in the same context. + * The #GtkCellAreaContext object is created by a given #GtkCellArea + * implementation via it's #GtkCellAreaClass.create_context() virtual + * method and is used to store cell sizes and alignments for a series of + * #GtkTreeModel rows that are requested and rendered in the same context. * - * #GtkCellLayout widgets can create any number of contexts in which to request and render - * groups of data rows. However its important that the same context which was used to - * request sizes for a given #GtkTreeModel row also be used for the same row when calling - * other #GtkCellArea apis such as gtk_cell_area_render() and gtk_cell_area_event(). + * #GtkCellLayout widgets can create any number of contexts in which to + * request and render groups of data rows. However its important that the + * same context which was used to request sizes for a given #GtkTreeModel + * row also be used for the same row when calling other #GtkCellArea APIs + * such as gtk_cell_area_render() and gtk_cell_area_event(). */ + #include "config.h" #include "gtkintl.h" #include "gtkmarshalers.h" @@ -42,21 +46,21 @@ #include "gtkprivate.h" /* GObjectClass */ -static void gtk_cell_area_context_dispose (GObject *object); -static void gtk_cell_area_context_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec); -static void gtk_cell_area_context_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec); +static void gtk_cell_area_context_dispose (GObject *object); +static void gtk_cell_area_context_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gtk_cell_area_context_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); /* GtkCellAreaContextClass */ -static void gtk_cell_area_context_real_reset (GtkCellAreaContext *context); -static void gtk_cell_area_context_real_allocate (GtkCellAreaContext *context, - gint width, - gint height); +static void gtk_cell_area_context_real_reset (GtkCellAreaContext *context); +static void gtk_cell_area_context_real_allocate (GtkCellAreaContext *context, + gint width, + gint height); struct _GtkCellAreaContextPrivate { @@ -87,8 +91,8 @@ gtk_cell_area_context_init (GtkCellAreaContext *context) GtkCellAreaContextPrivate *priv; context->priv = G_TYPE_INSTANCE_GET_PRIVATE (context, - GTK_TYPE_CELL_AREA_CONTEXT, - GtkCellAreaContextPrivate); + GTK_TYPE_CELL_AREA_CONTEXT, + GtkCellAreaContextPrivate); priv = context->priv; priv->min_width = -1; @@ -97,7 +101,7 @@ gtk_cell_area_context_init (GtkCellAreaContext *context) priv->nat_height = -1; } -static void +static void gtk_cell_area_context_class_init (GtkCellAreaContextClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); @@ -121,10 +125,10 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class) g_object_class_install_property (object_class, PROP_CELL_AREA, g_param_spec_object ("area", - P_("Area"), - P_("The Cell Area this context was created for"), - GTK_TYPE_CELL_AREA, - GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + P_("Area"), + P_("The Cell Area this context was created for"), + GTK_TYPE_CELL_AREA, + GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); /** * GtkCellAreaContext:minimum-width: @@ -138,12 +142,12 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class) g_object_class_install_property (object_class, PROP_MIN_WIDTH, g_param_spec_int ("minimum-width", - P_("Minimum Width"), - P_("Minimum cached width"), - -1, - G_MAXINT, - -1, - G_PARAM_READABLE)); + P_("Minimum Width"), + P_("Minimum cached width"), + -1, + G_MAXINT, + -1, + G_PARAM_READABLE)); /** * GtkCellAreaContext:natural-width: @@ -157,12 +161,12 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class) g_object_class_install_property (object_class, PROP_NAT_WIDTH, g_param_spec_int ("natural-width", - P_("Minimum Width"), - P_("Minimum cached width"), - -1, - G_MAXINT, - -1, - G_PARAM_READABLE)); + P_("Minimum Width"), + P_("Minimum cached width"), + -1, + G_MAXINT, + -1, + G_PARAM_READABLE)); /** * GtkCellAreaContext:minimum-height: @@ -176,12 +180,12 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class) g_object_class_install_property (object_class, PROP_MIN_HEIGHT, g_param_spec_int ("minimum-height", - P_("Minimum Height"), - P_("Minimum cached height"), - -1, - G_MAXINT, - -1, - G_PARAM_READABLE)); + P_("Minimum Height"), + P_("Minimum cached height"), + -1, + G_MAXINT, + -1, + G_PARAM_READABLE)); /** * GtkCellAreaContext:natural-height: @@ -195,12 +199,12 @@ gtk_cell_area_context_class_init (GtkCellAreaContextClass *class) g_object_class_install_property (object_class, PROP_NAT_HEIGHT, g_param_spec_int ("natural-height", - P_("Minimum Height"), - P_("Minimum cached height"), - -1, - G_MAXINT, - -1, - G_PARAM_READABLE)); + P_("Minimum Height"), + P_("Minimum cached height"), + -1, + G_MAXINT, + -1, + G_PARAM_READABLE)); g_type_class_add_private (object_class, sizeof (GtkCellAreaContextPrivate)); } @@ -226,9 +230,9 @@ gtk_cell_area_context_dispose (GObject *object) static void gtk_cell_area_context_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) + guint prop_id, + const GValue *value, + GParamSpec *pspec) { GtkCellAreaContext *context = GTK_CELL_AREA_CONTEXT (object); GtkCellAreaContextPrivate *priv = context->priv; @@ -246,9 +250,9 @@ gtk_cell_area_context_set_property (GObject *object, static void gtk_cell_area_context_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) + guint prop_id, + GValue *value, + GParamSpec *pspec) { GtkCellAreaContext *context = GTK_CELL_AREA_CONTEXT (object); GtkCellAreaContextPrivate *priv = context->priv; @@ -277,13 +281,13 @@ gtk_cell_area_context_get_property (GObject *object, } /************************************************************* - * GtkCellAreaContextClass * + * GtkCellAreaContextClass * *************************************************************/ static void gtk_cell_area_context_real_reset (GtkCellAreaContext *context) { GtkCellAreaContextPrivate *priv = context->priv; - + g_object_freeze_notify (G_OBJECT (context)); if (priv->min_width != -1) @@ -318,8 +322,8 @@ gtk_cell_area_context_real_reset (GtkCellAreaContext *context) static void gtk_cell_area_context_real_allocate (GtkCellAreaContext *context, - gint width, - gint height) + gint width, + gint height) { GtkCellAreaContextPrivate *priv = context->priv; @@ -336,13 +340,13 @@ gtk_cell_area_context_real_allocate (GtkCellAreaContext *context, * * Fetches the #GtkCellArea this @context was created by. * - * This is generally unneeded by layouting widgets however - * its important for the context implementation itself to + * This is generally unneeded by layouting widgets; however + * it is important for the context implementation itself to * fetch information about the area it is being used for. * * For instance at #GtkCellAreaContextClass.allocate() time * it's important to know details about any cell spacing - * that the #GtkCellArea is configured with in order to + * that the #GtkCellArea is configured with in order to * compute a proper allocation. * * Return value: the #GtkCellArea this context was created by. @@ -366,15 +370,15 @@ gtk_cell_area_context_get_area (GtkCellAreaContext *context) * @context: a #GtkCellAreaContext * * Resets any previously cached request and allocation - * data. + * data. * - * When underlying #GtkTreeModel data changes it's + * When underlying #GtkTreeModel data changes it's * important to reset the context if the content * size is allowed to shrink. If the content size * is only allowed to grow (this is usually an option * for views rendering large data stores as a measure * of optimization), then only the row that changed - * or was inserted needs to be (re)requested with + * or was inserted needs to be (re)requested with * gtk_cell_area_get_preferred_width(). * * When the new overall size of the context requires @@ -401,24 +405,28 @@ gtk_cell_area_context_reset (GtkCellAreaContext *context) /** * gtk_cell_area_context_allocate: * @context: a #GtkCellAreaContext - * @width: the allocated width for all #GtkTreeModel rows rendered with @context, or -1. - * @height: the allocated height for all #GtkTreeModel rows rendered with @context, or -1. - * - * Allocates a width and/or a height for all rows which are to be rendered with @context. - * - * Usually allocation is performed only horizontally or sometimes vertically since - * a group of rows are usually rendered side by side vertically or horizontally and - * share either the same width or the same hieght. Sometimes they are allocated in - * both horizontal and vertical orientations producing a homogenious effect of the - * rows. This is generally the case for #GtkTreeView when #GtkTreeView:fixed-height-mode - * is enabled. + * @width: the allocated width for all #GtkTreeModel rows rendered + * with @context, or -1. + * @height: the allocated height for all #GtkTreeModel rows rendered + * with @context, or -1. + * + * Allocates a width and/or a height for all rows which are to be + * rendered with @context. + * + * Usually allocation is performed only horizontally or sometimes + * vertically since a group of rows are usually rendered side by + * side vertically or horizontally and share either the same width + * or the same height. Sometimes they are allocated in both horizontal + * and vertical orientations producing a homogeneous effect of the + * rows. This is generally the case for #GtkTreeView when + * #GtkTreeView:fixed-height-mode is enabled. * * Since 3.0 */ void gtk_cell_area_context_allocate (GtkCellAreaContext *context, - gint width, - gint height) + gint width, + gint height) { g_return_if_fail (GTK_IS_CELL_AREA_CONTEXT (context)); @@ -428,21 +436,23 @@ gtk_cell_area_context_allocate (GtkCellAreaContext *context, /** * gtk_cell_area_context_get_preferred_width: * @context: a #GtkCellAreaContext - * @minimum_width: (out) (allow-none): location to store the minimum width, or %NULL - * @natural_width: (out) (allow-none): location to store the natural width, or %NULL + * @minimum_width: (out) (allow-none): location to store the minimum width, + * or %NULL + * @natural_width: (out) (allow-none): location to store the natural width, + * or %NULL * - * Gets the accumulative preferred width for all rows which have been requested - * with this context. + * Gets the accumulative preferred width for all rows which have been + * requested with this context. * - * After gtk_cell_area_context_reset() is called and/or before ever requesting - * the size of a #GtkCellArea, the returned values are -1. + * After gtk_cell_area_context_reset() is called and/or before ever + * requesting the size of a #GtkCellArea, the returned values are -1. * - * Since: 3.0 + * Since: 3.0 */ void gtk_cell_area_context_get_preferred_width (GtkCellAreaContext *context, - gint *minimum_width, - gint *natural_width) + gint *minimum_width, + gint *natural_width) { GtkCellAreaContextPrivate *priv; @@ -460,21 +470,23 @@ gtk_cell_area_context_get_preferred_width (GtkCellAreaContext *context, /** * gtk_cell_area_context_get_preferred_height: * @context: a #GtkCellAreaContext - * @minimum_height: (out) (allow-none): location to store the minimum height, or %NULL - * @natural_height: (out) (allow-none): location to store the natural height, or %NULL + * @minimum_height: (out) (allow-none): location to store the minimum height, + * or %NULL + * @natural_height: (out) (allow-none): location to store the natural height, + * or %NULL * - * Gets the accumulative preferred height for all rows which have been requested - * with this context. + * Gets the accumulative preferred height for all rows which have been + * requested with this context. * - * After gtk_cell_area_context_reset() is called and/or before ever requesting - * the size of a #GtkCellArea, the returned values are -1. + * After gtk_cell_area_context_reset() is called and/or before ever + * requesting the size of a #GtkCellArea, the returned values are -1. * * Since: 3.0 */ void gtk_cell_area_context_get_preferred_height (GtkCellAreaContext *context, - gint *minimum_height, - gint *natural_height) + gint *minimum_height, + gint *natural_height) { GtkCellAreaContextPrivate *priv; @@ -493,67 +505,71 @@ gtk_cell_area_context_get_preferred_height (GtkCellAreaContext *context, * gtk_cell_area_context_get_preferred_height_for_width: * @context: a #GtkCellAreaContext * @width: a proposed width for allocation - * @minimum_height: (out) (allow-none): location to store the minimum height, or %NULL - * @natural_height: (out) (allow-none): location to store the natural height, or %NULL + * @minimum_height: (out) (allow-none): location to store the minimum height, + * or %NULL + * @natural_height: (out) (allow-none): location to store the natural height, + * or %NULL * - * Gets the accumulative preferred height for @width for all rows which have been - * requested for the same said @width with this context. + * Gets the accumulative preferred height for @width for all rows + * which have been requested for the same said @width with this context. * - * After gtk_cell_area_context_reset() is called and/or before ever requesting - * the size of a #GtkCellArea, the returned values are -1. + * After gtk_cell_area_context_reset() is called and/or before ever + * requesting the size of a #GtkCellArea, the returned values are -1. * * Since: 3.0 */ void gtk_cell_area_context_get_preferred_height_for_width (GtkCellAreaContext *context, - gint width, - gint *minimum_height, - gint *natural_height) + gint width, + gint *minimum_height, + gint *natural_height) { g_return_if_fail (GTK_IS_CELL_AREA_CONTEXT (context)); if (GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->get_preferred_height_for_width) GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->get_preferred_height_for_width (context, - width, - minimum_height, - natural_height); + width, + minimum_height, + natural_height); } /** * gtk_cell_area_context_get_preferred_width_for_height: * @context: a #GtkCellAreaContext * @height: a proposed height for allocation - * @minimum_width: (out) (allow-none): location to store the minimum width, or %NULL - * @natural_width: (out) (allow-none): location to store the natural width, or %NULL + * @minimum_width: (out) (allow-none): location to store the minimum width, + * or %NULL + * @natural_width: (out) (allow-none): location to store the natural width, + * or %NULL * - * Gets the accumulative preferred width for @height for all rows which have - * been requested for the same said @height with this context. + * Gets the accumulative preferred width for @height for all rows which + * have been requested for the same said @height with this context. * - * After gtk_cell_area_context_reset() is called and/or before ever requesting - * the size of a #GtkCellArea, the returned values are -1. + * After gtk_cell_area_context_reset() is called and/or before ever + * requesting the size of a #GtkCellArea, the returned values are -1. * - * Since: 3.0 + * Since: 3.0 */ void gtk_cell_area_context_get_preferred_width_for_height (GtkCellAreaContext *context, - gint height, - gint *minimum_width, - gint *natural_width) -{ + gint height, + gint *minimum_width, + gint *natural_width) +{ g_return_if_fail (GTK_IS_CELL_AREA_CONTEXT (context)); if (GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->get_preferred_width_for_height) GTK_CELL_AREA_CONTEXT_GET_CLASS (context)->get_preferred_width_for_height (context, - height, - minimum_width, - natural_width); + height, + minimum_width, + natural_width); } /** * gtk_cell_area_context_get_allocation: * @context: a #GtkCellAreaContext - * @width: (out) (allow-none): location to store the allocated width, or %NULL. - * @height: (out) (allow-none): location to store the allocated height, or %NULL. + * @width: (out) (allow-none): location to store the allocated width, or %NULL + * @height: (out) (allow-none): location to store the allocated height, or %NULL * * Fetches the current allocation size for @context. * @@ -565,8 +581,8 @@ gtk_cell_area_context_get_preferred_width_for_height (GtkCellAreaContext *contex */ void gtk_cell_area_context_get_allocation (GtkCellAreaContext *context, - gint *width, - gint *height) + gint *width, + gint *height) { GtkCellAreaContextPrivate *priv; @@ -584,8 +600,8 @@ gtk_cell_area_context_get_allocation (GtkCellAreaContext *context, /** * gtk_cell_area_context_push_preferred_width: * @context: a #GtkCellAreaContext - * @minimum_width: the proposed new minimum width for @context. - * @natural_width: the proposed new natural width for @context. + * @minimum_width: the proposed new minimum width for @context + * @natural_width: the proposed new natural width for @context * * Causes the minimum and/or natural width to grow if the new * proposed sizes exceed the current minimum and natural width. @@ -599,8 +615,8 @@ gtk_cell_area_context_get_allocation (GtkCellAreaContext *context, */ void gtk_cell_area_context_push_preferred_width (GtkCellAreaContext *context, - gint minimum_width, - gint natural_width) + gint minimum_width, + gint natural_width) { GtkCellAreaContextPrivate *priv; @@ -630,8 +646,8 @@ gtk_cell_area_context_push_preferred_width (GtkCellAreaContext *context, /** * gtk_cell_area_context_push_preferred_height: * @context: a #GtkCellAreaContext - * @minimum_height: the proposed new minimum height for @context. - * @natural_height: the proposed new natural height for @context. + * @minimum_height: the proposed new minimum height for @context + * @natural_height: the proposed new natural height for @context * * Causes the minimum and/or natural height to grow if the new * proposed sizes exceed the current minimum and natural height. @@ -645,11 +661,11 @@ gtk_cell_area_context_push_preferred_width (GtkCellAreaContext *context, */ void gtk_cell_area_context_push_preferred_height (GtkCellAreaContext *context, - gint minimum_height, - gint natural_height) + gint minimum_height, + gint natural_height) { GtkCellAreaContextPrivate *priv; - + g_return_if_fail (GTK_IS_CELL_AREA_CONTEXT (context)); priv = context->priv; diff --git a/gtk/gtkcellareacontext.h b/gtk/gtkcellareacontext.h index 3c3522bc59..787344e619 100644 --- a/gtk/gtkcellareacontext.h +++ b/gtk/gtkcellareacontext.h @@ -32,10 +32,10 @@ G_BEGIN_DECLS -#define GTK_TYPE_CELL_AREA_CONTEXT (gtk_cell_area_context_get_type ()) -#define GTK_CELL_AREA_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA_CONTEXT, GtkCellAreaContext)) +#define GTK_TYPE_CELL_AREA_CONTEXT (gtk_cell_area_context_get_type ()) +#define GTK_CELL_AREA_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_AREA_CONTEXT, GtkCellAreaContext)) #define GTK_CELL_AREA_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_AREA_CONTEXT, GtkCellAreaContextClass)) -#define GTK_IS_CELL_AREA_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA_CONTEXT)) +#define GTK_IS_CELL_AREA_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_AREA_CONTEXT)) #define GTK_IS_CELL_AREA_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_AREA_CONTEXT)) #define GTK_CELL_AREA_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_AREA_CONTEXT, GtkCellAreaContextClass)) @@ -52,16 +52,16 @@ struct _GtkCellAreaContext /** * GtkCellAreaContextClass: - * @allocate: This tells the context that an allocation width or height (or both) - * have been decided for a group of rows. The context should store any allocations - * for internally aligned cells at this point so that they dont need to be - * recalculated at gtk_cell_area_render() time. - * @reset: Clear any previously stored information about requested and allocated - * sizes for the context. - * @get_preferred_height_for_width: Returns the aligned height for the given width - * that context must store while collecting sizes for it's rows. - * @get_preferred_width_for_height: Returns the aligned width for the given height - * that context must store while collecting sizes for it's rows. + * @allocate: This tells the context that an allocation width or height + * (or both) have been decided for a group of rows. The context should + * store any allocations for internally aligned cells at this point so + * that they dont need to be recalculated at gtk_cell_area_render() time. + * @reset: Clear any previously stored information about requested and + * allocated sizes for the context. + * @get_preferred_height_for_width: Returns the aligned height for the given + * width that context must store while collecting sizes for it's rows. + * @get_preferred_width_for_height: Returns the aligned width for the given + * height that context must store while collecting sizes for it's rows. */ struct _GtkCellAreaContextClass { @@ -70,17 +70,17 @@ struct _GtkCellAreaContextClass /*< public >*/ void (* allocate) (GtkCellAreaContext *context, - gint width, - gint height); + gint width, + gint height); void (* reset) (GtkCellAreaContext *context); void (* get_preferred_height_for_width) (GtkCellAreaContext *context, - gint width, - gint *minimum_height, - gint *natural_height); + gint width, + gint *minimum_height, + gint *natural_height); void (* get_preferred_width_for_height) (GtkCellAreaContext *context, - gint height, - gint *minimum_width, - gint *natural_width); + gint height, + gint *minimum_width, + gint *natural_width); /*< private >*/ /* Padding for future expansion */ @@ -97,36 +97,40 @@ GType gtk_cell_area_context_get_type (void) G_GNUC_CONST; /* Main apis */ GtkCellArea *gtk_cell_area_context_get_area (GtkCellAreaContext *context); void gtk_cell_area_context_allocate (GtkCellAreaContext *context, - gint width, - gint height); + gint width, + gint height); void gtk_cell_area_context_reset (GtkCellAreaContext *context); -/* Apis for GtkCellArea clients to consult cached values for a series of GtkTreeModel rows */ +/* Apis for GtkCellArea clients to consult cached values + * for a series of GtkTreeModel rows + */ void gtk_cell_area_context_get_preferred_width (GtkCellAreaContext *context, - gint *minimum_width, - gint *natural_width); + gint *minimum_width, + gint *natural_width); void gtk_cell_area_context_get_preferred_height (GtkCellAreaContext *context, - gint *minimum_height, - gint *natural_height); + gint *minimum_height, + gint *natural_height); void gtk_cell_area_context_get_preferred_height_for_width (GtkCellAreaContext *context, - gint width, - gint *minimum_height, - gint *natural_height); + gint width, + gint *minimum_height, + gint *natural_height); void gtk_cell_area_context_get_preferred_width_for_height (GtkCellAreaContext *context, - gint height, - gint *minimum_width, - gint *natural_width); + gint height, + gint *minimum_width, + gint *natural_width); void gtk_cell_area_context_get_allocation (GtkCellAreaContext *context, - gint *width, - gint *height); + gint *width, + gint *height); -/* Apis for GtkCellArea implementations to update cached values for multiple GtkTreeModel rows */ +/* Apis for GtkCellArea implementations to update cached values + * for multiple GtkTreeModel rows + */ void gtk_cell_area_context_push_preferred_width (GtkCellAreaContext *context, - gint minimum_width, - gint natural_width); + gint minimum_width, + gint natural_width); void gtk_cell_area_context_push_preferred_height (GtkCellAreaContext *context, - gint minimum_height, - gint natural_height); + gint minimum_height, + gint natural_height); G_END_DECLS -- 2.30.2